Skip to content

Scotland | SDC NOV | Katarzyna Kazimierczuk | Sprint 2 | Improve with caches#161

Open
katarzynakaz wants to merge 3 commits intoCodeYourFuture:mainfrom
katarzynakaz:improve-with-caches
Open

Scotland | SDC NOV | Katarzyna Kazimierczuk | Sprint 2 | Improve with caches#161
katarzynakaz wants to merge 3 commits intoCodeYourFuture:mainfrom
katarzynakaz:improve-with-caches

Conversation

@katarzynakaz
Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Improve time complexity using memoization for recursive functions.

@katarzynakaz katarzynakaz added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 18, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions Bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Apr 18, 2026
@github-actions

This comment has been minimized.

@katarzynakaz katarzynakaz changed the title Scotland | SDC NOV | Katarzyna Kazimierczuk | Sprint 2 | Precomputing Scotland | SDC NOV | Katarzyna Kazimierczuk | Sprint 2 | Improve with caches Apr 18, 2026
Copy link
Copy Markdown
Member

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, well done!

@@ -1,4 +1,12 @@
def fibonacci(n):
def fibonacci(n, memo=None):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works, and will cache all of the calls within one call to fibonacci, but if we wrote this code:

fibonacci(20)
fibonacci(20)

The second call wouldn't be any faster than the first. Can you think how to get this benefit as well?

@illicitonion illicitonion added the Reviewed Volunteer to add when completing a review with trainee action still to take. label May 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants