refactor: Condense password related files in one (#7939)

* refactor: Condense `password` related files in one

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update other/password.py

Co-authored-by: Christian Clauss <cclauss@me.com>

* dynamic_programming

* test: Make test input `str`

* requirements.txt: Remove cython>=0.29.28  # For statsmodels on Python 3.11

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Christian Clauss <cclauss@me.com>
This commit is contained in:
Caeden Perelli-Harris
2022-11-02 16:20:57 +00:00
committed by GitHub
parent f05baa2b2b
commit 598f6a26a1
4 changed files with 46 additions and 54 deletions

View File

@ -112,12 +112,12 @@ def mincost_tickets(days: list[int], costs: list[int]) -> int:
return 0
if index not in days_set:
return dp(index + 1)
return dynamic_programming(index + 1)
return min(
costs[0] + dp(index + 1),
costs[1] + dp(index + 7),
costs[2] + dp(index + 30),
costs[0] + dynamic_programming(index + 1),
costs[1] + dynamic_programming(index + 7),
costs[2] + dynamic_programming(index + 30),
)
return dynamic_programming(1)