Check if a number is palindrome

O(N) solution