In the Leetcode Palindrome Number problem solution in Java programming Given an integer x, return true if x is a palindrome, and false otherwise.
Leetcode Palindrome Number problem solution in Java programming
class Solution {
public boolean isPalindrome(int s) {
String x=String.valueOf(s);
int i=0,j=x.length()-1;
while(i<=j){
if(x.charAt(i)!=x.charAt(j))
return false;
i++;
j--;
}
return true;
}
}
Also read,
- Leetcode Palindrome Number problem solution in C++
- Leetcode Palindrome Number problem solution in C
- Leetcode Palindrome Number problem solution in Python
- Leetcode Palindrome Number problem solution in C#