Given a 1-indexed sorted array of integers, find two numbers that add up to the target.
The two pointers start at opposite ends and move inward based on the sum comparison.
This achieves O(n) time with O(1) extra space.
Execution
idle
Press Run to begin the two-pointer visualization.
0 / 0
Speed
Java · running line
active / comparingmatched / solution
O(n) time · O(1) extra space · Sorted array allows two pointers to converge efficiently.