The problem is given here- http://opc.iarcs.org.in/index.php/problems/BOOKSORT
1 Like
The problem is essentially asking for the longest increasing subsequence of the given sequence. The accepted answer here talks about how to solve this, first in O(N^2), then in O(NlogN). For the given constraints, the O(NlogN) solution is required.
1 Like
Oh damn! Now I see it. Thanx.
1 Like