Check palindrome number and next palindrome
Company: Microsoft
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Onsite
Quick Answer: This question evaluates understanding of numeric and string manipulation along with algorithmic problem-solving for palindrome detection and generation, including handling large integers and edge cases.
Palindrome Number
Examples
Input: (1221,)
Expected Output: True
Explanation: Palindrome.
Input: (123,)
Expected Output: False
Explanation: Not palindrome.
Input: (0,)
Expected Output: True
Explanation: Zero.
Next Palindrome Number
Examples
Input: (132,)
Expected Output: 141
Explanation: Next is 141.
Input: (9,)
Expected Output: 11
Explanation: Single digit.
Input: (10,)
Expected Output: 11
Explanation: Next 11.
Input: (999,)
Expected Output: 1001
Explanation: Carry increases length.
Input: (1221,)
Expected Output: 1331
Explanation: Strictly greater.