Given an integer, check if that integer is a palindrome. For this problem do not convert the integer to a string to check if it is a palindrom code example
Example: determine whether integer is a palindrome
public class Solution {
public bool IsPalindrome(int x) {
if(x < 0 || (x % 10 == 0 && x != 0)) {
return false;
}
int revertedNumber = 0;
while(x > revertedNumber) {
revertedNumber = revertedNumber * 10 + x % 10;
x /= 10;
}
return x == revertedNumber || x == revertedNumber/10;
}
}