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

LongestNondecreasingSubsequenceNlogn.java Needs a code fix #13

Open
rudbaby opened this issue Apr 26, 2015 · 1 comment
Open

LongestNondecreasingSubsequenceNlogn.java Needs a code fix #13

rudbaby opened this issue Apr 26, 2015 · 1 comment

Comments

@rudbaby
Copy link

rudbaby commented Apr 26, 2015

https://github.com/epibook/epibook.github.io/blob/master/solutions/java/src/main/java/com/epi/LongestNondecreasingSubsequenceNlogn.java

this logic is completely wrong. if you pass the distinct elements as input, then control always goes to if condition. you never get to go to else. and you end returning the size of the input list.

  public static void main(String[] args) {
    Integer a[] = {0,8,4,12,2,10,6,14,1,9};
    List<Integer> input = Arrays.asList(a);
    longestNondecreasingSubsequence(input);
  }
@thlee-uber
Copy link
Collaborator

Hey Bhanu,

Could you verify the update code for us? We recently update the code and verify those changes by our own test cases.

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

2 participants