diff --git a/leetCode Solutions/Q9_Palindrome_Number/Q9_Palindrome_Number.java b/leetCode Solutions/Q9_Palindrome_Number/Q9_Palindrome_Number.java new file mode 100644 index 0000000..1e48db8 --- /dev/null +++ b/leetCode Solutions/Q9_Palindrome_Number/Q9_Palindrome_Number.java @@ -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; + } +} \ No newline at end of file