Easy Problems

125. Valid Palindrome

Solutions

function isPalindrome(s: string): boolean {
  const result = s.replace(/[^a-zA-Z0-9]/g, '').toLowerCase().split(''); // s.replace(/[^0-9a-z]/gi, '')
  return result.join('') === result.reverse().join('')
};

Video Solution

Last Update: 12:08 - 16 April 2024
Two Pointers
String

On this page