Two-sum problem
= Two-sum problem
Find two distinct input positions whose values sum to a target, or establish that no such pair exists. Distinct values are not required: two equal values may form a pair when they occur at different positions. On a <sorted array>, <distinct-index two-sum by suffix lower bounds> gives $O(N\log N)$ <running time>, while a <two-pointer technique> can give linear time.