FastPrepPow(x, n)
Problems/Pow(x, n)

Pow(x, n)

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREENONSITE INTERVIEW

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a firsthand Bloomberg new-grad phone interview. Our version uses exponentiation by squaring and allows negative 32-bit exponents.

Return x raised to the integer power n.

For a negative exponent, return the reciprocal of the corresponding positive power.

Function

myPow(x: double, n: int) → double

Examples

Example 1

x = 2.0n = 10return = 1024.0

Two multiplied ten times is 1024.

Example 2

x = 2.0n = -2return = 0.25

A negative exponent takes the reciprocal.

Constraints

  • -100.0 < x < 100.0.
  • n is a 32-bit signed integer.
  • Inputs avoid undefined division by zero.

More Bloomberg LP Phone Screen questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE 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

Similar questions at other companies

  • Path Between Two Nodes of a Fibonacci TreeDatabricks · PHONE SCREEN · ONSITE INTERVIEWDatabricks interview questions
  • Power with Integer ExponentsLinkedIn · ONSITE INTERVIEWLinkedIn interview questions
  • Power with Integer ExponentsNVIDIA · PHONE SCREENNVIDIA interview questions
  • Raise a Number to an Integer PowerAdobe · PHONE SCREENAdobe interview questions
  • Every Result of Grouping an ExpressionC3.ai · ONSITE INTERVIEWC3.ai interview questions
  • Integer Power Without a Library CallExpedia · ONSITE INTERVIEWExpedia interview questions
  • Fibonacci NumberMicrosoft · ONSITE INTERVIEWMicrosoft interview questions
  • Decision Tree Classifier from ScratchZillow · ONSITE INTERVIEWZillow interview questions
  • Josephus SurvivorApple · ONSITE INTERVIEWApple interview questions
  • N-th Fibonacci NumberBank of America · ONSITE INTERVIEWBank of America interview questions

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)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
class Solution {
    public double myPow(double x, int n) {
      // Write your code here.
    }
}
Checking account…