Skip to content

London | 26-SDC-Jul | AYK | Sprint 2 | Improve code with caches - #270

Open
sarawone wants to merge 2 commits into
CodeYourFuture:mainfrom
sarawone:AYK_Improve_Code_with_caches
Open

sarawone wants to merge 2 commits into
CodeYourFuture:mainfrom
sarawone:AYK_Improve_Code_with_caches

Conversation

@sarawone

@sarawone sarawone commented Nov 5, 2026

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

Task code

CYF-1182

Changelist

Hi,

Thanks for your time reviewing & providing feedback for this PR.

Thanks and Regards,
AYK

@sarawone sarawone added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Complexity The name of the module. labels Nov 5, 2026

@cjyuan cjyuan left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The Changelist content does not quite describe what were changed in this PR. Could you use AI to explore "what to write in the Changelist of a PR?", and then update your Changelist?

Comment on lines +20 to +29
"""

dp = [0] * (total+1)
dp[0] =1

for coin in coins:
for amount in range(coin,total+1):
dp[amount] += dp[amount-coin]
return dp[total]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The code on lines 22-28 implements a totally different approach. While this approach is more efficient, implementing it beats the purpose of the exercise -- identify and caching reusable computed values in an implementation and reuse them.

Could you improve the original code instead?

Comment on lines +1 to +7
def fibonacci(n,memo = {}):
if n in memo:
return memo[n]
if n <= 2:
return 1
memo[n]=fibonacci(n - 1,memo) + fibonacci(n - 2,memo)
return memo[n]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The spacing around parameters/arguments, and around operators are not consistent. Could you use a formatter to keep the format consistent?

@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Complexity The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants