FastPrepPalindrome Number
Problems/Palindrome Number

Palindrome Number

Microsoft logoMicrosoft● EasyINTERNONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: One of the technical questions in a Microsoft software engineering internship process, reported in a review, was a number-palindrome check with string conversion ruled out.

The report gives no range and no rule for negative numbers. Here x is any 32-bit integer, negative numbers are never palindromes, and you return true or false. The no-strings rule is part of the statement, but the tests cannot check it.

Our version is about 95% the same as the reported question.

Given an integer x, return true if it reads the same from left to right as from right to left, and false otherwise.

Read x as it is written in decimal, including a minus sign if it has one. So a negative number is never a palindrome, because the minus sign appears only at the start.

Solve it without converting x to a string. The tests cannot check this part, but it is the point of the question.

Function

isPalindrome(x: int) → boolean

Examples

Example 1

x = 121return = true

Read from left to right the digits are 1, 2, 1, and from right to left they are also 1, 2, 1, so the answer is true.

Example 2

x = -121return = false

From left to right it reads -121; from right to left it would read 121-. The minus sign makes every negative number not a palindrome.

Example 3

x = 10return = false

Reversed, the digits read 0, 1, which is 01, not 10. So the answer is false.

Constraints

  • -2^31 <= x <= 2^31 - 1

More Microsoft Onsite Interview questions

  • Longest Substring Without Repeating CharactersONSITE INTERVIEW · Seen Nov 2026
  • Valid ParenthesesONSITE INTERVIEW · Seen Nov 2026
  • Count a User's Actions in an Event LogONSITE INTERVIEW · Seen Nov 2026
  • Smallest Batch Size Within a Step LimitONSITE INTERVIEW · Seen Nov 2026
  • Count Subarrays with Equal Even and Odd CountsONSITE INTERVIEW · Seen Nov 2026
  • Minimum Time to Rot All OrangesONSITE INTERVIEW · Seen Nov 2026
  • Coin ChangeONSITE INTERVIEW · Seen Oct 2026
  • Daily USD Totals with Effective-Dated Exchange RatesONSITE INTERVIEW · Seen Oct 2026
  • Number Words to Digits in Any LanguageONSITE INTERVIEW · Seen Oct 2026
  • Totals from a Tiered Rate TableONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Plus OneDruva · ONSITE INTERVIEW
  • Rotate a Flat Image ClockwiseGoogle · ONSITE INTERVIEWGoogle interview questions
  • Matrix MultiplicationeBay · ONSITE INTERVIEWeBay interview questions
  • Maximum Product of Three IntegersPelatro · ONSITE INTERVIEW
  • Climbing StairsAmazon · ONSITE INTERVIEW
  • Maximum 69 NumberHSBC · ONSITE INTERVIEWHSBC interview questions
  • Roman to IntegerKotak Mahindra Bank · PHONE SCREEN · ONSITE INTERVIEWKotak Mahindra Bank interview questions
  • Exact-Sixty Dice Game ValueJane Street · ONSITE INTERVIEWJane Street interview questions
  • Find the Missing Number from 1 to nHyperVerge · ONSITE INTERVIEW
  • Alternating Index Square SumAccenture · ONSITE INTERVIEWAccenture interview questions

Interview reports that mention this question

  • Microsoft SWE Intern Interviews: 244 Experiences (Part 1 of 6)

Microsoft interview experiences

  • Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
  • Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
  • Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
  • Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)
  • Microsoft SWE Intern, Early 2026: 54 Experiences (Part 2 of 6)
All Microsoft interview questionsSee Microsoft hiring insights
Saved
class Solution {
    public boolean isPalindrome(int x) {
        // Write your code here.
    }
}
Checking account…