You are given a 0-indexed integer array nums that is already sorted in non-decreasing order, find two numbers such that they add up to a specific target number. Return the indices of the two numbers, index1 and index2, where 1 <= index1 < index2 <= nums.length.
The tests are generated such that there is exactly one solution. You may not use the same element twice. If no result exist, then return the empty array.
nums = [2, 7, 11, 15]
target = 9
[0, 1]
The numbers 2 and 7 add up to 9. Their 1-based indices are 1 and 2.
nums = [2, 3, 4]
target = 6
[0, 2]
The numbers 2 and 4 add up to 6. Their 1-based indices are 2 and 3.
nums = [-1, 0]
target = -1
[0, 1]
The numbers -1 and 0 add up to -1. Their 1-based indices are 1 and 2.
nums = [2, 7, 11, 15]
target = 9
[0, 1]