Skip to main content
CodeOath
← All problems

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.

Example 1
Input
str = "Level"
Output
true
Explanation

in lower case it is "level", which is the same in both directions.

Example 2
Input
str = "hello"
Output
false
Explanation

read backwards it is "olleh".

Example 3
Input
str = ""
Output
true
Explanation

an empty string counts as a palindrome.

Tab indents. Press Esc, then Tab to leave the editor.

Run your code to see every test here. Nothing is submitted or recorded.