Visualization step 1 of 13. VISIT.
State
Vvisit
Step 1 / 13A activeQ queuedOK doneX discarded
Array Visualization
-4
0
-1
1
-1
2
0
3
1
4
2
5
Step 1 / 13
Step 1 of 13. VISIT. Sort nums ascending: [-1, 0, 1, 2, -1, -4] becomes [-4, -1, -1, 0, 1, 2]. Sorting lets duplicate values sit next to each other and lets two pointers scan a fixed value's remaining pair in one direction each.
Step Explanation1 / 13
VISIT
Sort nums ascending: [-1, 0, 1, 2, -1, -4] becomes [-4, -1, -1, 0, 1, 2]. Sorting lets duplicate values sit next to each other and lets two pointers scan a fixed value's remaining pair in one direction each.
Output0 results