정석
def solution(phone_book):
answer = True
hash_map = {}
for phone_num in phone_book:
hash_map[phone_num] = 1
for phone_num in phone_book:
temp = ""
for num in phone_num:
temp += num
if temp in hash_map and temp != phone_num:
return False
return answer
초간단
def solution(phoneBook):
s_phoneBook = sorted(phoneBook)
for p1, p2 in zip(s_phoneBook, s_phoneBook[1:]):
if p2.startswith(p1):
return False
return True