Skip to content

Commit

Permalink
36.py
Browse files Browse the repository at this point in the history
  • Loading branch information
huisuu committed Aug 22, 2024
1 parent 93ad338 commit cc90dc2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions HSKIM/31to40/36.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
def solution(phone_book):
# 사전 순으로 앞서는 것을 앞으로 정렬
phone_book.sort( )

for i in range(len(phone_book) - 1):
# startswith 는 현재 문자열이 사용자가 지정하는 특정 문자로 시작하는지 확인하는 함수
if phone_book[i + 1].startswith(phone_book[i]):
return False
return True

phone_book = ["119", "97674223", "1195524421"]
print(solution(phone_book))

0 comments on commit cc90dc2

Please sign in to comment.