Given a 1-indexed array of integers numbers sorted in non-decreasing order, find two numbers such that they add up to target. Return the indices as [index1, index2] (1-indexed), where index1 < index2. You may not use the same element twice.
Input: numbers = [2,7,11,15], target = 9
Output: [1,2]
Topics: arrays, two-pointers
Asked by: Amazon, Google, Meta, Microsoft, Adobe
Time complexity: O(n). Space complexity: O(1).