@juver++: yeah! i get that! i thought the segment tree approach was worth mentioning because more general problems can be solved using this. eg:- Find the longest increasing subsequence such that the difference between any 2 consecutive elements of the sequence you choose is atmost 'k'. (Instead of querying in range [1,a[i]-1], just query in range[a[i]-k,a[i]-1]).
On Dec 31, 12:27 pm, juver++ <[email protected]> wrote: > And of course simple binary search. -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
