728x90
금방 풀었다. 풀었던 문제여서 일 수도 있다.
def solution(phone_book):
answer = True
phone_book = sorted(phone_book)
for i in range(0,len(phone_book)-1):
# 앞의 길이가 더 크면 넘기기
a = phone_book[i]
b = phone_book[i+1]
if len(list(a)) > len(list(b)):
continue
if a == b[0:len(list(a))]:
return False
return True728x90
'🟢 알고리즘 문제 풀이 > Programmers' 카테고리의 다른 글
| [파이썬] 프로그래머스 폰켓몬 (0) | 2023.02.24 |
|---|---|
| [파이썬] 프로그래머스 오픈채팅방 (0) | 2023.02.21 |
| [파이썬] 프로그래머스 영어 끝말잇기 (0) | 2023.02.18 |
| [파이썬] 프로그래머스 [1차] 뉴스 클러스터링 (0) | 2023.02.17 |
| [파이썬] 프로그래머스 멀리 뛰기 (0) | 2023.02.17 |