Two sum (puzzle)

Given an array of integers nums̀ and an integer target, return indices of the two numbers such that they add up to target.

You may assume that each input would have exactly one solution, and you may not use the same element twice. - LeetCode

Two Sum II - Input array is sorted

Written on September 10, 2020, Last update on April 11, 2021
leetcode puzzle algorithm