Skip to content
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

Leaves - Georgina #31

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Leaves - Georgina #31

wants to merge 2 commits into from

Conversation

geomsb
Copy link

@geomsb geomsb commented Apr 1, 2020

No description provided.

Copy link

@CheezItMan CheezItMan left a comment

Choose a reason for hiding this comment

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

Well you have the newman conway sequence working, but you have some errors in the max_sub_array method. Something to look at. If you have questions or want me to take another look let me know.


i = 0
while i < nums.length
max_ending_here = max_ending_here + a[i]

Choose a reason for hiding this comment

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

What is a?

Comment on lines +1 to +16
# Time comPlexity: O(n)
# Space ComPlexity: O(n)
def p(n, memo)
if memo[n] != nil
return memo[n]
end
if n == 1 || n == 2
result = 1
else
result = p(p(n - 1, memo), memo) + p(n - p(n - 1, memo), memo)
end
memo[n] = result
return result
end

def newman_conway(n)

Choose a reason for hiding this comment

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

nice combination of recursion & dynamic programming.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants