Valid Palindrome
Thu Oct 23 2025 10:16:44 GMT+0000 (Coordinated Universal Time)
Saved by
@Inescn
public boolean isPalindrome(String s) {
if (s == null) return false;
s = s.toLowerCase().replaceAll("[^a-z0-9]", "")
int left = 0;
int right = s.length() - 1;
while (left < right) {
if (s.charAt(left) != s.charAt(right)) {
return false;
}
left++;
right--;
}
return true;
}
content_copyCOPY
Comments