Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/tiaz0128/ch_08/solution_021.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
from collections import Counter


def solution(want, number, discount):
return
answer = 0

wanted_items = {want[idx]: cnt for idx, cnt in enumerate(number)}

for idx, item in enumerate(discount):
items = discount[idx : idx + 10]
counter = Counter(items)

if all(
[
cnt <= counter.get(category, False)
for category, cnt in wanted_items.items()
]
):
answer += 1

return answer