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