Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 39796

SPOJ PROBLEM LIS2

$
0
0

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


Viewing all articles
Browse latest Browse all 39796

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>