125. Valid Palindrome | LeetCode | Top Interview 150 | Coding Questions
Published: (December 28, 2025 at 05:31 PM EST)
1 min read
Source: Dev.to
Source: Dev.to
Problem
Solution
class Solution {
public boolean isPalindrome(String s) {
s = s.toLowerCase();
int left = 0;
int right = s.length() - 1;
while (left = 'a' && chLeft = '0' && chLeft = 'a' && chRight = '0' && chRight <= '9')) {
right--;
continue;
}
// Compare the current characters
if (chLeft != chRight) {
return false;
}
left++;
right--;
}
return true;
}
}