Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3691. Maximum Total Subarray Value II
Pick exactly k distinct non-empty subarrays (overlaps allowed) to maximize the sum of their ranges (max - min). The core challenge is to efficiently compute and rank subarray range values—by decomposing contributions of each element as a subarray maximum or minimum (monotonic stacks) and extracting the top-k totals—without enumerating all O(n^2) subarrays.
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.