← ALL NOTES
LeetCode

Find Two Non-overlapping Sub-arrays Each With Target Sum

Sliding window enumerates every target-sum subarray in one pass; a prefix-minimum best[] pairs each closing window with the shortest disjoint window before it in O(n).

Loading…