solution to isPalindrome (number version)