FastPrepReverse Integer
Problems/Reverse Integer

Reverse Integer

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: A graduate candidate's report from a London Bloomberg interview, the opening coding round, gives this task in one sentence: take a whole number that fits in 32 bits, sign included, and return it with the order of its digits flipped. It says nothing about results that no longer fit, and gives no examples.

Everything else here is our practice choice. The sign stays in front, zeros that land at the front of the result are dropped, and when the flipped value falls outside the 32-bit range for numbers with a sign, the function returns 0. Any 32-bit input is allowed.

The judged task matches the report at about 90%.

You are given a signed 32-bit integer x. Write the digits of x in the opposite order and return that number, keeping the sign of x. Zeros that end up at the front of the reversed number are dropped, so 1200 becomes 21.

If the reversed number is smaller than -2147483648 or larger than 2147483647, it does not fit in a signed 32-bit integer; return 0 instead.

Function

reverse(x: int) → int

Examples

Example 1

x = 4096return = 6904

The digits 4, 0, 9, 6 read backwards are 6, 9, 0, 4, so the answer is 6904.

Example 2

x = -5070return = -705

Reverse the digits of 5070 to get 0705. The leading zero is dropped, giving 705, and the minus sign stays: -705.

Example 3

x = -2147483412return = -2143847412

The digits of 2147483412 backwards are 2143847412. The result -2143847412 is still at least -2147483648, so it fits in a 32-bit integer and is returned.

Example 4

x = 1999999999return = 0

Backwards the digits give 9999999991. That is larger than 2147483647, the largest 32-bit integer, so the answer is 0.

Constraints

  • -2147483648 <= x <= 2147483647 (any signed 32-bit integer)

More Bloomberg LP Phone Screen questions

  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026
  • Add Two Numbers IIPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Integers With Multiple Sum of Two CubesCharta Health · PHONE SCREEN · ONSITE INTERVIEWCharta Health interview questions
  • Dice-Walk Winning ProbabilityGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Logistic Regression with Gradient DescentYahoo · PHONE SCREENYahoo interview questions
  • Evaluate an Arithmetic Expression Written in WordsBrex · PHONE SCREEN
  • Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
  • Integer to English Words in USD and INR StylesVeeam · PHONE SCREEN
  • Adaptive Calibration ErrorOpenAI · PHONE SCREENOpenAI interview questions
  • Sum of Smallest Non-DivisorsThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Square Root FunctionCitadel · PHONE SCREENCitadel interview questions
  • Reorderable Task Scheduler With CooldownWaymo · PHONE SCREENWaymo interview questions

Interview reports that mention this question

  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public int reverse(int x) {
        // Write your code here.
    }
}
Checking account…