Skip to content

Commit 62af637

Browse files
committed
[#6,7,8]폰켓몬, 완주하지 못한 선수, 전화번호 목록
1 parent 4630a6a commit 62af637

File tree

3 files changed

+25
-0
lines changed

3 files changed

+25
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def solution(participant, completion):
2+
runner = {}
3+
4+
for p in participant:
5+
if p in runner:
6+
runner[p] += 1
7+
else:
8+
runner[p] = 1
9+
10+
for c in completion:
11+
runner[c] -= 1
12+
13+
for player, count in runner.items():
14+
if count != 0:
15+
return player
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
def solution(phone_book):
2+
phone_book.sort()
3+
4+
for i in range(len(phone_book) - 1):
5+
if phone_book[i] == phone_book[i + 1][:len(phone_book[i])]:
6+
return False
7+
8+
return True

So-Myoung/1주차/폰켓몬.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
def solution(nums):
2+
return min(len(nums)/2, len(set(nums)))

0 commit comments

Comments
 (0)