Two Sum II - Input Array Is Sorted

Medium · Arrays & Strings · about 10 minutes

Asked at Meta, Amazon, Google, Microsoft, Bloomberg, Oracle, IBM, Morgan Stanley.

numbers is sorted ascending and its positions are counted from 1. Exactly one pair of positions index1 < index2 holds values that add up to target. Return [index1, index2], and keep extra memory at O(1).

Related guides