-
Notifications
You must be signed in to change notification settings - Fork 1
Conversation
|
||
|
||
# 해시로 풀기 | ||
def solution(phone_book: List) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
해시로 푼 풀이가 인상깊었습니다! 이번 문제 효율은 역시 정렬의 풀이가 빠르겠지만 해시 테이블로도 풀이가 가능하다는 것에 의미가 있는 것 같습니다!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 해시 풀이 잘 보고갑니다!! 이번 문제 외에도 보편적으로 특정 키를 찾을 때 유용하게 사용할 수 있을 거 같아서 좋네요!!
2) O(nm): n은 전화번호의 총 개수, m은 최대 | ||
|
||
<기타> | ||
이 외에 트라이로도 풀이 가능 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
트라이는 또 뭡니까?! ㅋㅋㅋㅋㅋㅋ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저번에 말했던 검색 엔진에 많이 사용하는 알고리즘이용 Trie!
|
||
|
||
# 해시로 풀기 | ||
def solution(phone_book: List) -> bool: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
저도 해시 풀이 잘 보고갑니다!! 이번 문제 외에도 보편적으로 특정 키를 찾을 때 유용하게 사용할 수 있을 거 같아서 좋네요!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
깔끔한 두 종류의 풀이를 함께 보면서 비교할 수 있어서 좋았던 것 같습니다. 고생하셨습니다~
def solution(phone_book: List) -> bool: | ||
phone_hash = {} # 전화번호 접두사를 저장할 해시 | ||
|
||
# 각 전화번호의 접두사를 해시에 저장 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
왜 문제의 주제가 해시인지 몰랐었는데 풀이를 보고 이해가 되었습니다. 해시를 활용하지 않는다면 이 반복문이 필요가 없이 phone_book을 참조하면 되는 것인데, 해시 참조의 효율성 때문에 해시를 만들어서 시간 내에 문제를 해결할 수 있군요! 도움이 많이 되었습니다.
PR Summary
풀이시간: 10분
<input>
<solution>
<시간 복잡도>
<기타>
이 외에 트라이로도 풀이 가능