mirror of
https://github.com/arkorty/LeetCode.git
synced 2026-03-17 16:51:46 +00:00
Initial commit
This commit is contained in:
13
Easy/palindrome-number/solution.c
Normal file
13
Easy/palindrome-number/solution.c
Normal file
@@ -0,0 +1,13 @@
|
||||
bool isPalindrome(long int a) {
|
||||
if (a < 0)
|
||||
return false;
|
||||
|
||||
long int b = 0;
|
||||
for (long int c = a; c != 0; c /= 10)
|
||||
b = b * 10 + (c % 10);
|
||||
|
||||
if (a == b)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user