-
Notifications
You must be signed in to change notification settings - Fork 53
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
M. Nguyen - Dynamic Programming #29
base: master
Are you sure you want to change the base?
Conversation
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 Melissa, you hit the learning goals here. I do encourage you to try the space/time complexity questions as it's good practice.
@@ -0,0 +1,7 @@ | |||
{ |
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.
The .vscode
folder could be added to .gitignore
|
||
# default both variables to the first index b/c the first index is the max value and max ending thus far | ||
max_so_far = nums[0] | ||
max_ending_here = nums[0] | ||
|
||
for i in range(1, len(nums)): | ||
|
||
max_ending_here = max(max_ending_here + nums[i], nums[i]) | ||
|
||
# continue updating value of variable as we itr | ||
max_so_far = max(max_so_far, max_ending_here) | ||
|
||
return max_so_far |
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.
👍 space/time complexity?
Time Complexity: ? | ||
Space Complexity: ? | ||
""" |
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.
👍 Space/time complexity?
No description provided.