Skip to content

Commit

Permalink
체육복 (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
ezidayzi committed Dec 28, 2021
1 parent b08b045 commit 4738a5d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Algorithm/프로그래머스/체육복.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
n = 6
lost = [2, 4]
reserve = [1, 3, 5]

set_lost = set(lost) - set(reserve)
set_reserve = set(reserve) - set(lost)

for i in set_reserve:
if i - 1 in set_lost:
set_lost.remove(i-1)
continue

if i + 1 in set_lost:
set_lost.remove(i+1)
continue

answer = n - len(set_lost)

print(answer)

0 comments on commit 4738a5d

Please sign in to comment.