Find the longest strictly increasing subsequence where adjacent elements differ by at most . For [4,2,1,4,3,4,5,8,15] with , the answer is from subsequence [1,3,4,5,8].
Unlike standard LIS, the difference constraint requires a different approach. You'll use a segment tree for efficient range queries.
Example: [4,2,1,4,3,4,5,8,15], k=3 → 5. Longest subsequence with adjacent difference at most .
Constraints: nums.length , nums[i], .