Leetcode, Scala, Palindrome Number, Programming, Technical Interview.
equal, it means the number reads the same backward as forward, thus x is a palindrome. Solution 2: Revert Half of the Number object Solution { def isPalindrome(x: Int): Boolean = { // Step 1: Exclude negative numbers and numbers ending with zero if (x < 0 || (x % 10 == 0 && x != 0)) return false