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

MaximumSumSubsequence.java edge cases #258

Open
nguyendviet opened this issue Feb 12, 2020 · 0 comments
Open

MaximumSumSubsequence.java edge cases #258

nguyendviet opened this issue Feb 12, 2020 · 0 comments

Comments

@nguyendviet
Copy link

I think your code here doesn't handle edge cases because it doesn't have the logic:

If T[j] + arr[i] < T[i] => do nothing like in your video here at 4:00.

// line 26
if(arr[j] < arr[i] ){ // should be arr[j] < arr[i] && T[j] + arr[i] >= T[i]
   T[i] = Math.max(T[i], T[j] + arr[i]); // should be T[i] = T[j] + arr[i]
}
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

No branches or pull requests

1 participant