Can someone provide some hint for solving this prbolem of spoj www.spoj.com/problems/LIS2/. The approach I am trying is very similar to the LIS dp solution(O(Nlogn)). But my solution doesnot give correct answer for all cases I am testing upon.
Basically I am selecting the first minimum pair and inserting its index in an auxillary array and then checking with the rest of the pairs. If any new pair can be inserted in the end, that will count for length of LIS and any pair perfectly less than any value already existing in an array, i am inserting in the array, finding its position through binary search. Here is the rough idea of what I am doing : http://ideone.com/kyIJMf