-
Notifications
You must be signed in to change notification settings - Fork 29
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
Alex #7
base: master
Are you sure you want to change the base?
Alex #7
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, you hit all the time and space complexities and solved both problems using a dynamic programming approach. Well done.
# Time Complexity: ? | ||
# Space Complexity: ? | ||
# Time Complexity: O(n) where n is the length of nums | ||
# Space Complexity: O(1) | ||
def max_sub_array(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.
👍
# Time complexity: ? | ||
# Space Complexity: ? | ||
# Time complexity: O(n) where n is the size of num | ||
# Space Complexity: O(n) bc I am making an array dependent on size of num, 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.
👍
end | ||
|
||
p = Array.new(num) |
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.
Just note, p
isn't exactly a meaning ful variable name, although I recognize it is from the formula.
No description provided.