My 2-line java code


  • 5
    T

    well, not counting the scaffolding ...

        public class Solution {
        public boolean isPalindrome(String s) {
            String ss = s.toLowerCase().replaceAll("[^a-z0-9]", "");
            return ss.equals(new StringBuilder(ss).reverse().toString());
        }
    }

Log in to reply
 

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