23. Two Sum
Lesson 24 of 31 in Coddy's 30 Days of Logic Building in Javascript course.
Challenge
EasyGiven an array of numbers and a target sum, find two numbers in the array that add up to the target and return their indexes!
- Input:
<strong>arr = [2, 7, 11, 15], target = 9</strong> - Expected Output:
<strong>[0, 1]</strong>(2 + 7 = 9)
Try it yourself
function twoSum(arr, target) {
// write your code below
}
All lessons in 30 Days of Logic Building in Javascript
1Introduction
What is here for you?