Valid Palindrome
A phrase is a palindrome if, after converting all uppercase letters to lowercase and removing every character that is not a letter or a digit, it reads the same forwards and backwards.
Given a string s, return true if it is a palindrome and false otherwise.
Constraints
1 <= s.length <= 2 * 10^5scontains printable ASCII characters only.- Aim for O(1) extra space: don't build a cleaned copy of the string.
Examples
Example 1
Input: s = "A man, a plan, a canal: Panama" Output: true
Keeping only letters and digits and lowering the case gives "amanaplanacanalpanama", which reads the same both ways.
Example 2
Input: s = "race a car" Output: false
"raceacar" read backwards is "racaecar".
Example 3
Input: s = " " Output: true
No letters or digits remain. An empty string is a palindrome.
JavaScript you'll use: Strings and characters
/**
* @param {string} s
* @return {boolean}
*/
function isPalindrome(s) {
}
Ctrl/⌘ + ' runs the examples, Ctrl/⌘ + Enter submits. Use console.log freely: output shows under Console. In the editor, press Esc then Tab to move focus out.