Leetcode Palindrome Number problem solution in Java programming

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,

By Neha Singhal

Hi, my name is Neha singhal a software engineer and coder by profession. I like to solve coding problems that give me the power to write posts for this site.

Leave a Reply

Your email address will not be published. Required fields are marked *