Solution to TWO SUMS using JavaScript

4 months ago
13

TWO SUMS is an interesting but tricky challenge. But here is a solution that walks you through the logic in a beginner-friendly manner. I started by explaining the question, denoting the input and expected output format, and unblocking the challenge. You'll learn to solve this challenge easily.

Come on, practice makes perfect. What's a day without solving a challenge? Watch now

QUESTION
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 can return the answer in any order.

Loading comments...