FastPrepPalindrome Number

Palindrome Number

Bloomberg LP logoBloomberg LP● EasyNEW GRADPHONE SCREENONSITE INTERVIEW
Learn

Problem statement

Given a signed integer x, return whether its decimal representation reads the same from left to right and right to left.

Negative integers are not palindromes.

Function

isPalindromeNumber(x: int) → boolean

Examples

Example 1

x = 121return = true

121 reads identically in both directions.

Example 2

x = -121return = false

The minus sign has no matching suffix.

Constraints

  • x is a 32-bit signed integer.

More Bloomberg LP problems

See Bloomberg LP hiring insights
public boolean isPalindromeNumber(int x) {
  // Write your code here.
}
x121
expectedtrue
Checking account…