Two Sum — Sorted

CodingEasy

Asked by: Google, Morgan Stanley

Description

Given a sorted array and target, find the two indices that sum to target. O(n) time.

Hints

Hint 1

Use two pointers.

Hint 2

Start from both ends.

Solution