Leetcode in Java && Oracle
420 subscribers
8 photos
397 files
400 links
Second channel: @codeforces_java

Let's Develop Together!
Download Telegram
image_2021-10-27_15-23-19.png
35.2 KB
#N9. Palindrome Number
problem link=>https://leetcode.com/problems/palindrome-number/

#solution
class Solution {
public boolean isPalindrome(int x) {
if(x<0) return false;
int num=x;
int palindrome=0;
int temp=0;
while(true){
temp=x%10;
x/=10;
palindrome=palindrome*10+temp;
if(x==0)
break;
}

return num==palindrome;
}
}