Skip to content

Commit

Permalink
Merge pull request DHEERAJHARODE#559 from tamojeetK/main
Browse files Browse the repository at this point in the history
Added Leetcode solution code for Palindrome
  • Loading branch information
DHEERAJHARODE committed Oct 1, 2022
2 parents 4f5c3b9 + 8fbf11e commit ff296cc
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions Java/Palindrome.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
public class Palindrome {
public static boolean isPalindrome(int n) {
int temp = n;
int rem;
int ans = 0;
while(n>0){
rem = n%10;
ans = ans*10+rem;
n=n/10;
}
if(ans==temp){
return true;
}
return false;
}
public static void main(String[] args){
int N = 124321;
boolean res = isPalindrome(N);
System.out.print(res);
}
}

0 comments on commit ff296cc

Please sign in to comment.