HardRating 2280
2407. Longest Increasing Subsequence II
arraydivide-and-conquerdynamic-programmingbinary-indexed-treesegment-treequeuemonotonic-queue
解題說明
C++ 解法
複雜度分析
虛擬碼
1. Build a segment tree over value range [0, max(nums)] 2. For each element x in nums: a. Query segment tree for max value in range [x-k, x-1] b. current_length = query_result + 1 c. Update segment tree at position x with current_length (if larger) d. Update global answer 3. Return answer