Skip to content

Commit

Permalink
Merge pull request #2 from AlgoLeadMe/1-suhyun113
Browse files Browse the repository at this point in the history
1-suhyun113
  • Loading branch information
suhyun113 committed Apr 2, 2024
2 parents 8bafb48 + 3a06fc4 commit ee472a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions suhyun113/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

| 차시 | 날짜 | 문제유형 | 링크 | 풀이 |
|:----:|:---------:|:----:|:-----:|:----:|
| 1차시 | 2024.02.12 | DP | [평범한 배낭](https://www.acmicpc.net/problem/12865) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-7/pull/5) |
---
| 1차시 | 2024.03.25 | 그리디 | [체육복](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) |
---
14 changes: 14 additions & 0 deletions suhyun113/그리디/1-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
def solution(n, lost, reserve):
answer = 0

re = list(set(reserve) - set(lost))
lo = list(set(lost) - set(reserve))

for i in re:
if i-1 in lo:
lo.remove(i-1)
elif i+1 in lo:
lo.remove(i+1)

answer = n - len(lo)
return answer

0 comments on commit ee472a0

Please sign in to comment.