← All problemsExample 1 Example 2 Example 3
Problem
Valid Palindrome
Easy- strings
Return true when str reads the same from left to right and from right to left, treating upper and lower case as equal. Return false otherwise.
- Input
str = "Level"- Output
true- Explanation
in lower case it is "level", which is the same in both directions.
- Input
str = "hello"- Output
false- Explanation
read backwards it is "olleh".
- Input
str = ""- Output
true- Explanation
an empty string counts as a palindrome.
Tab indents. Press Esc, then Tab to leave the editor.
Ctrl or ⌘ + Enter runs the tests.
Run your code to see every test here. Nothing is submitted or recorded.