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

Simplify dpMaximumSubarray #189

Conversation

appleJax
Copy link
Contributor

Alternate PR to #160

Changes:

  • Remove special case handling of array with all negative numbers
  • Keep track of start/end indices and return a copy of maxSubarray at the end, rather than keeping a greedy copy of maxSubarray

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
@appleJax appleJax force-pushed the refactor/dpMaximumSubarray branch from 47d79d7 to bcaf3ef Compare August 30, 2018 05:30
@trekhleb trekhleb changed the base branch from master to max-subarray-simplification September 4, 2018 06:46
@trekhleb
Copy link
Owner

trekhleb commented Sep 4, 2018

@appleJax thank you for simplification.

@trekhleb trekhleb merged commit 2a2b5da into trekhleb:max-subarray-simplification Sep 4, 2018
@appleJax appleJax deleted the refactor/dpMaximumSubarray branch September 4, 2018 20:04
harshes53 pushed a commit to harshes53/javascript-algorithms that referenced this pull request Dec 6, 2018
* Simplify dpMaximumSubarray

* change var name from currentMaxSum to currentSum

* fix comment with old variable name
shoredata pushed a commit to shoredata/javascript-algorithms that referenced this pull request Mar 28, 2019
* Simplify dpMaximumSubarray

* change var name from currentMaxSum to currentSum

* fix comment with old variable name
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.

None yet

2 participants