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