Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1425. Constrained Subsequence Sum
Find the maximum-sum non-empty subsequence of nums such that consecutive chosen indices differ by at most k. This is a DP problem where dp[i] = nums[i] + max(0, max dp[j] for j in [i-k, i-1]), typically solved efficiently by maintaining a sliding-window maximum (monotonic deque) for n up to 1e5.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.