Find the longest subsequence where each element is 1 greater than the previous element.
Follow up 1: Difference between the current element and the previous element can be between 1 and k
Follow up 2: Print longest subsequence elements
Follow up 3: Optimize any two of your approach O(n×k) or O(n×n)
Suggested Segment tree approach
Comments (5)


