Skip to content

Commit

Permalink
feat : 할인 행사 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
jeeminimini committed Nov 11, 2023
1 parent 29950d4 commit ce6a267
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/main/kotlin/jimin/49week/할인 행사.py
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ce6a267

Please sign in to comment.