Arrays & Hashing · Easy
Contains Duplicate
O(N) · O(N)
Initialize Hash Map
Target is 2. We iterate through nums array and maintain a hash map of { value: index }.
Array Elements & Pointers
1
i=02
i=13
i=21
i=3Live Variables & Invariants
target:2
i:0
current:-
complement:-
Step 1 / 9
11%
Solution Code
LeetCode IDE Console
Test Cases
3 cases from Blind 75 & NeetCode 150
Ask for a hint whenever you get stuck.