2407. Longest Increasing Subsequence II
LeetCodeArrayDivide and ConquerDynamic ProgrammingBinary Indexed TreeSegment TreeQueueOpen on judge ↗
You are given an integer array nums and an integer k. Find the longest subsequence of nums that meets the following requirements: - The subsequence is strictly increasing and - The difference between adjacent elements in the subsequence is at most k. Return the length of the longest subsequence that meets the requirements. A subsequence is an array that can be derived from another array by de
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start