DSA Visualizer

The question

1. Two Sum

Level 1EasyArrays & Hashing

Given an array of numbers and a target, find the two positions whose values add up to the target. Exactly one such pair exists, and you may not use the same position twice.

Example: numbers = [2,7,11,15], target = 9 → [0,1]

Pattern: Arrays & Hashing. Remember what you have seen in a map or set, so later items can be checked in one step instead of a second loop.

Press Visualize to step through the code.