-
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
dynamic-programming #32
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.
Overall nice work Sumitra, you're not quite right on the max subarray problem. Check out my comment and let me know what questions you have.
@@ -0,0 +1,17 @@ | |||
{ |
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.
You can probably add .vscode
to your .gitignore
file.
@@ -4,9 +4,31 @@ def max_sub_array(nums): | |||
Returns 0 if nums is None or an empty list. | |||
Time Complexity: ? | |||
Space Complexity: ? | |||
Does this have to be contiguous? |
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.
Yes
if max_so_far <= 0: | ||
return max(nums) |
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.
Note putting this if
statement in the loop means that if the 1st number is negative the function will find the largest number in the array and return it instead of finding the max contiguous subarray.
def newman_conway(num): | ||
""" Returns a list of the Newman Conway numbers for the given value. | ||
Time Complexity: ? | ||
Space Complexity: ? | ||
Time Complexity: o(n) | ||
Space Complexity: 0(n) | ||
""" |
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.
👍 Well done
No description provided.