Given a vector A and target n, return the indices of two numbers that add up to n. If there are multiple solutions, return the first one.
Solution Stats
Problem Comments
1 Comment
Solution Comments
Show comments
Loading...
Problem Recent Solvers17
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
52680 Solvers
-
6436 Solvers
-
Find the two most distant points
2950 Solvers
-
1621 Solvers
-
Generate N equally spaced intervals between -L and L
943 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!
The problem needs more tests. And it should state what to do when it is not possible to find two numbers that add up to n.