Algorithms & Data Structureseasy
Pair Sum in a Sorted Array
Given an array of integers sorted in ascending order and a target value, return the indices of two distinct elements that sum to the target, or [-1, -1] if no such pair exists.
Follow-up: solve it in O(n) time and O(1) extra space, then discuss how your approach changes if the array is unsorted.