Skip to content

Commit

Permalink
Merge pull request #17 from napalion/main
Browse files Browse the repository at this point in the history
Q9_PalindromeNumber in Java
  • Loading branch information
DugarRishab authored Oct 2, 2022
2 parents e28d630 + 7e4ad70 commit d900f7a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions leetCode Solutions/Q9_Palindrome_Number/Q9_Palindrome_Number.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
class Palindrome {
public boolean isPalindrome(int x) {
if(x < 0){
return false;
}
int n = 0;
int copy = x;
int newnum = 0;
while(copy > 0){
int y = copy%10;
newnum = (newnum*10) + y;
copy = copy/10;

}
if(newnum != x){
return false;
}
return true;
}
}

0 comments on commit d900f7a

Please sign in to comment.