Skip to content

Add solution for Project Euler problem 191 #2875

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Oct 11, 2020
Merged
Changes from 1 commit
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
Prev Previous commit
Address requested changes
  • Loading branch information
darkstar committed Oct 11, 2020
commit 210786412ec92974bc75e09b8a442203ca6323de
6 changes: 0 additions & 6 deletions project_euler/problem_191/sol1.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"""


# a cache to speed up calculation
cache = {}


Expand Down Expand Up @@ -84,9 +83,6 @@ def _calculate(days: int, absent: int, late: int) -> int:

prizestrings = state_late + state_absent + state_ontime

# keep the value we calculated in the cache, so that later we do not
# need to recurse again. This is the main improvement which brings
# runtime down from seconds/minutes to usually below 1 second.
cache[key] = prizestrings
return prizestrings

Expand All @@ -102,8 +98,6 @@ def solution(days: int = 30) -> int:
43
"""

# we call the calculate function above, with initially
# no absent days and no late days.
return _calculate(days, absent=0, late=0)


Expand Down