Skip to content

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