Skip to content

LongestNondecreasingSubsequenceNlogn.java Needs a code fix #13

@rudbaby

Description

@rudbaby

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);
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions