Java one liner 49ms


  • -2
    R
    public class Solution {
        public boolean isPalindrome(String s) {
            return s.replaceAll("[^A-Za-z0-9]", "").toLowerCase().equals(new StringBuilder(s.replaceAll("[^A-Za-z0-9]", "").toLowerCase()).reverse().toString());
        }
    }

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.