Data Structures & Algorithms using JavaScript
/Intermediate
Two Sum Pattern
Definition
The most famous algorithmic pattern. Given an array, find two numbers that add up to a target. Solved in O(N) time and O(N) space using a Hash Map to store `target - current_value`.
Explain Like I'm New
Instead of checking every possible pair of numbers, you write down what number you need to hit the target. If you see that number later, you win.
Interactive Coding Challenges
Write the Brute Force O(N^2) solution for Two Sum.
Solution Code
Loading...
Console output will appear here...