From ce6a26788d2a8454375c5cac73cc94b3555e7c06 Mon Sep 17 00:00:00 2001 From: jeeminimini Date: Sun, 12 Nov 2023 00:51:45 +0900 Subject: [PATCH] =?UTF-8?q?feat=20:=20=ED=95=A0=EC=9D=B8=20=ED=96=89?= =?UTF-8?q?=EC=82=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0\354\235\270 \355\226\211\354\202\254.py" | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 "src/main/kotlin/jimin/49week/\355\225\240\354\235\270 \355\226\211\354\202\254.py" diff --git "a/src/main/kotlin/jimin/49week/\355\225\240\354\235\270 \355\226\211\354\202\254.py" "b/src/main/kotlin/jimin/49week/\355\225\240\354\235\270 \355\226\211\354\202\254.py" new file mode 100644 index 00000000..08576a9c --- /dev/null +++ "b/src/main/kotlin/jimin/49week/\355\225\240\354\235\270 \355\226\211\354\202\254.py" @@ -0,0 +1,28 @@ +from collections import defaultdict + +def solution(want, number, discount): + answer = 0 + + d_info = dict() + w_info = dict() + for product in set(discount): + d_info[product] = 0 + w_info[product] = 0 + + for i in range(10): + d_info[discount[i]] += 1 + + for idx, val in enumerate(want): + w_info[val] = number[idx] + + for i in range(10, len(discount)): + if w_info == d_info: + answer += 1 + + d_info[discount[i - 10]] -= 1 + d_info[discount[i]] += 1 + + if w_info == d_info: + answer += 1 + + return answer \ No newline at end of file