##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
Arrays are everywhere. Learn prefix sums for O(1) range queries and difference arrays for updates.
Combines sorting, prefix sum, and binary search in one problem. Learn how to precompute cumulative sums and answer range queries efficiently.
Cumulative totals
Perfect introduction to sliding window with prefix sums. Find k consecutive planks with minimum height using the add-one-remove-one pattern.
Teaches maintaining multiple prefix sum arrays (original and sorted). Shows when to precompute different views of data for O(1) queries.
Greedy approach with implicit prefix tracking. Find maximum sum of alternating positive/negative subsequence by identifying consecutive segments.
Classic two-pointer/sliding window problem. Find maximum number of consecutive books within time limit - fundamental pattern for subarray problems.
Advanced prefix sum with hashmap technique. Count subarrays where sum equals length by transforming to 'sum equals 0' problem.
Masterclass in prefix/suffix counting. Split array into 3 parts with equal sums - requires tracking valid split points efficiently.
THE problem to learn difference arrays. Handle range updates with nested operations - essential for understanding lazy propagation.
Transform comparison into prefix sum problem. Count pairs where a[i]+a[j] > b[i]+b[j] using difference array and sorting.
Prefix sum with divisibility insight. Minimum operations to make all equal by merging neighbors - check equal-sum segment partitions.
Implicit prefix tracking with state management. Partition binary string into minimum alternating subsequences using queue-based approach.
Greedy with prefix sum optimization using priority queue. Minimize operations to make prefix sum at position m the smallest.
Perfect introduction to prefix sum concept with straightforward implementation. Builds foundational understanding of cumulative sums.
The quintessential prefix sum + hashmap problem that teaches how to count subarrays with a target sum in O(n) time.
The iconic Kadane's algorithm for finding maximum subarray sum in O(n) time. Fundamental greedy algorithm every programmer must know.
Brilliant application of prefix and suffix products without division. Two-pass technique for O(n) solutions with O(1) extra space.
Non-obvious two-pointer greedy approach where moving the shorter pointer maximizes potential area.
Combines sorting with two-pointer technique to reduce O(n^3) to O(n^2). Must-know for interview preparation.
The fundamental 2D prefix sum problem with inclusion-exclusion principle. Essential for 2D range query problems.
Combines 2D prefix sums with the 'Subarray Sum Equals K' technique. The ultimate 2D prefix sum challenge.