dsa1 min read
Partition Labels — Greedy Interval Merge
Partition string so each letter appears in at most one part. Track last occurrence of each char; greedily extend current partition end.
Read →
1575 articles
Partition string so each letter appears in at most one part. Track last occurrence of each char; greedily extend current partition end.
Reconstruct queue where [h,k] means person of height h has k taller/equal people in front. Sort by height desc (then k asc), insert at index k.
Maximum score to reach end where each jump is 1..k steps. Monotonic deque (sliding window maximum) of DP values for O(n) solution.
Find max chunks of array that when sorted individually give fully sorted array. A chunk boundary exists when max(chunk so far) == current index.
Complete Greedy and Monotonic Stack cheatsheet: all patterns, templates, complexity table, and problem index.