-
Notifications
You must be signed in to change notification settings - Fork 29
Amy W #16
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
base: master
Are you sure you want to change the base?
Amy W #16
Conversation
CheezItMan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, you fully applied dynamic programming to these solutions. Well done!
| raise NotImplementedError, "Method not implemented yet!" | ||
| return 0 if nums == nil | ||
|
|
||
| max_so_far = nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just start max_so_far to the smallest integer possible, to simplify the if statement.
| def conway_helper(num, output) | ||
| return 1 if num < 3 | ||
| return output[num - 1] if output[num - 1] | ||
| helper = conway_helper(num - 1, output) | ||
| conway_helper(helper, output) + conway_helper(num - helper, output) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice method, both recursive and efficient!
No description provided.