Skip to content

Barcelona | OCT-2025-2 | Iheb Hamdi | Sprint 2 |Improve with cahces| Module-Complexity - #4

Open
hamdiheb wants to merge 7 commits into
mainfrom
sprint2/improveWithCaches
Open

Barcelona | OCT-2025-2 | Iheb Hamdi | Sprint 2 |Improve with cahces| Module-Complexity#4
hamdiheb wants to merge 7 commits into
mainfrom
sprint2/improveWithCaches

Conversation

@hamdiheb

Copy link
Copy Markdown
Owner

Summary

  • Memoize fibonacci with a dict cache threaded through recursive calls, turning exponential recursion into linear time.
  • Rewrite ways_to_make_change as bottom-up DP, using a ways list as the cache (ways[amount] = ways to make that amount with the coins considered so far). Avoids both the original's near-quadratic blowup and a Python recursion-depth crash hit while prototyping a memoized-recursive version for large totals (e.g. total=9176).
  • No @cache decorator used, per exercise constraints.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant