Pow(x, n)
Updated
Problem statement
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) → doubleExamples
Example 1
x = 2.0n = 10return = 1024.0Two multiplied ten times is 1024.
Example 2
x = 2.0n = -2return = 0.25A negative exponent takes the reciprocal.
Constraints
-100.0 < x < 100.0.nis 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)