Loading…
Play, pause, and step through classic algorithms — with real source code in multiple languages, right in your browser.
On a sorted array, two pointers start at the ends and move inward — growing or shrinking the sum — to find a pair with a target sum in O(n).
Maintains the sum of a fixed-size window as it slides across the array — adding the entering element and dropping the leaving one — to find the maximum window sum in O(n).