dsa1 min read
Split Array Largest Sum [Hard] — Binary Search on Answer
Minimize the largest sum among m subarrays by binary searching on the answer and greedy checking feasibility.
Read →
1575 articles
Minimize the largest sum among m subarrays by binary searching on the answer and greedy checking feasibility.
Find the shortest subarray with sum >= K using a monotonic deque on prefix sums, handling negative numbers correctly.
Count the number of range sums that lie in [lower, upper] using a merge sort approach on prefix sums.
Find three non-overlapping subarrays of length k with maximum sum using sliding window sums and left/right best index arrays.
Find the minimum refueling stops to reach target by greedily picking the largest fuel station passed so far whenever we run out.