Programs

Two Sum

Given an array of integers, return indices of the two numbers such that they add up to a specific target.

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

Given nums = [1, 4, 8, 13], target = 12,

Because nums[1] + nums[2] = 4 + 8 = 12,
return [1, 2].

Solution:

Share This Post

Lost Password

Register

24 Tutorials