Pattern Recognition Drill
Easy Arrays & Strings
The Problem
Given string s, return True if it's a palindrome.
What approach would you use?
Think about it before scrolling down.
Compare s[l] and s[r], converge inward. First mismatch → not a palindrome. O(n) time, O(1) space.
Push first half, compare with second half popping. Same complexity but more code.
Common Trap
s == s[::-1] works in Python but uses O(n) extra space and doesn't show algorithmic thinking.