Two Pointers · Medium
3Sum
O(N^2) · O(1)
Initialize Two Pointers
Array is sorted. Set left pointer L=0 (val -4) and right pointer R=5 (val 2).
Array Elements & Pointers
L ↓
-4
L-1
[1]-1
[2]0
[3]1
[4]R ↓
2
RLive Variables & Invariants
target:0
left:0
right:5
sum:-2
Step 1 / 7
14%
Solution Code
LeetCode IDE Console
Test Cases
3 cases from Blind 75 & NeetCode 150
Ask for a hint whenever you get stuck.