Problem 61153. Two Sum
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.
You must return smaller indices first.
Example:
Input: nums = [2,7,11,15], target = 9
Output: [1, 2]
Explanation: Because nums[1] + nums[2] == 9, we return [1, 2].
Solution Stats
Solution Comments
Show commentsProblem Recent Solvers8
Suggested Problems
-
8 Solvers
More from this Author1
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!