Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 3578. Count Partitions With Max-Min Difference at Most K
Count the number of ways to split an array into one or more contiguous segments so that in every segment the difference between its maximum and minimum is at most k, returning the result modulo 1e9+7. With n up to 5·10^4 this requires an O(n)–O(n log n) approach (DP with a sliding-window/monotonic structure to track valid segment boundaries).
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.