Back to exercises

Two Sum II (Sorted Array)

Start with one pointer at the left and one at the right. Move the left pointer rightward when the sum is too small and the right pointer leftward when the sum is too large.

Coding Exercises Easy O(n)

Two Sum II (Sorted Array)

Start with one pointer at the left and one at the right. Move the left pointer rightward when the sum is too small and the right pointer leftward when the sum is too large.

Given a sorted array, return the indices of two numbers that add up to a target.