Warm-ups · 14 of 24
Check if a string is a palindrome
Return true if the string reads the same forwards and backwards (compare characters exactly, case matters).
Examples
Input s = "madam"
Output true
Input s = "Aa"
Output false
'A' and 'a' are different characters here.
📘 New to this? Two pointers from opposite ends explains the idea in a few minutes.
Solved it? The same idea on LeetCode: try it there ↗