From b93c35d7f067e643c1d2e296321014cd7c8791e9 Mon Sep 17 00:00:00 2001 From: heerucan Date: Thu, 30 Dec 2021 23:25:20 +0900 Subject: [PATCH] =?UTF-8?q?[=ED=94=84=EB=A1=9C=EA=B7=B8=EB=9E=98=EB=A8=B8?= =?UTF-8?q?=EC=8A=A4]=20=EC=B2=B4=EC=9C=A1=EB=B3=B5(#1)=20-=20https://hure?= =?UTF-8?q?e-can-do-it.notion.site/6c5c2d075c0848deb05293a700a860cc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Programmers/main.py | 0 .../\354\262\264\354\234\241\353\263\265.py" | 12 ++++++++++++ 2 files changed, 12 insertions(+) create mode 100644 Programmers/main.py create mode 100644 "Programmers/\354\262\264\354\234\241\353\263\265.py" diff --git a/Programmers/main.py b/Programmers/main.py new file mode 100644 index 0000000..e69de29 diff --git "a/Programmers/\354\262\264\354\234\241\353\263\265.py" "b/Programmers/\354\262\264\354\234\241\353\263\265.py" new file mode 100644 index 0000000..9772802 --- /dev/null +++ "b/Programmers/\354\262\264\354\234\241\353\263\265.py" @@ -0,0 +1,12 @@ +# 풀이 참고 +def solution(n, lost, reserve): + # 여벌교복 가져온 학생도 도난 당할 수 있어서 중복삭제 + reserveSet = set(reserve) - set(lost) + lostSet = set(lost) - set(reserve) + + for i in reserveSet: + if i - 1 in lostSet: + lostSet.remove(i - 1) + elif i + 1 in lostSet: + lostSet.remove(i + 1) + return n - len(lostSet) \ No newline at end of file