My easy understanding answer using JAVA


  • 0
    M
    public class Solution {
    
    public boolean isPalindrome(String s) {
        
    String res = s.replaceAll("\\W","").toLowerCase();
        
    
    for(int i = 0; i < res.length() / 2; i++){
    
            if(res.charAt(i) != res.charAt(res.length() - 1 - i)) return false;
    
            else continue;
            }
        return true;
        }
    }

Log in to reply
 

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