Leetcode, Scala, Palindrome Number, Programming, Technical Interview.
Int): Boolean = { if (x < 0) return false var original = x var reversed = 0 while (original != 0) { reversed = reversed * 10 + original % 10 original /= 10 } x == reversed } } Time Complexity: O(log n) Similar to Solution 2, this method involves mathematical operations (division and modulo) that