#1
Two Sum
EasyArrays & HashingGiven an array of integers nums and an integer target, return the indices of the two numbers that add up to target.
You may assume that each input has exactly one solution, and you may not use the same element twice. Return the answer as [i, j] with i < j.
Example
nums = [2, 7, 11, 15], target = 9
=> [0, 1] // nums[0] + nums[1] == 9
Implement
function TwoSum(nums: int[], target: int) -> int[]
Found a bug? Or annoyed about something in the language? Tell us.
loading editor…