Determine Whether an Integer Is a Palindrome
Company: Bytedance
Role: Data Scientist
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Technical Screen
Quick Answer: A coding interview problem about determining whether an integer is a decimal palindrome. It tests negative-number handling, reversal logic, overflow-aware arithmetic alternatives, and clear time and space complexity analysis.
Constraints
- -2147483648 <= value <= 2147483647
- value is a signed 32-bit integer
Examples
Input: (0,)
Expected Output: True
Explanation: Zero has one digit and is a palindrome.
Input: (7,)
Expected Output: True
Explanation: Every non-negative one-digit integer is palindromic.
Hints
- Handle the sign before comparing digits.
- A nonzero value ending in zero cannot be a palindrome.
- Reverse only half of the digits to avoid reversing the entire integer.