DSA-VerseLearn by watching code run
DashboardData StructuresAlgorithmsVisualizerCORECoding PlaygroundInterview QuestionsComplexity AnalyzerLearning NotesBookmarksLearning ProgressSettings
Instrumented JavaScript implementation · lines sync with the animation

Run to execute this JavaScript code for real (output appears here).

Two Sum

arrays
3
8
11
2
7
15
0
1
2
3
4
5
Hash map · seen
key (value)→ index
empty
ComparingSwapping / movingCurrentSorted / finalFound / placed

Ready.

Finds two indexes whose values add up to a target in one pass, storing each value's index in a hash map and looking up the complement (target − value). Press Run (Ctrl + Enter) to animate, or Step forward (F10) to go one event at a time.

1 / 22

Execution

Step

1 / 22

Line (JavaScript)

—

FUNCTION_CALL

Variables

nums[3, 8, 11, 2, 7, 15]
target9
seen{}
Call stackdepth 0

main (no active function frames)

Operation counters

No counted operations yet.

Memory (measurable)

Hash map entries0
Auxiliary spaceO(n) — currently 0 entries

Data structure state

[3, 8, 11, 2, 7, 15]