Community

Start a Thread


Notifications
Subscribe You’re not receiving notifications from this thread.

Power of a Number (Main Thread)

Here is the interview question prompt, presented for reference.

Given a number x and an integer n, find the value of x raised to the power n ( xn ).

![image](https://storage.googleapis.com/algodailyrandomassets/curriculum/misc/power-of-a-number/problem.png)

For example, consider the following two numbers,

x = 2.1, n = 3

If the number 2.1 is multiplied by itself 3 times, then the answer is 9.261 (rounded to the nearest 100), which is 2.1 raised to the power 3.

Constraints

  • -100.0 < x < 100.0
  • -231 <= n <= 231-1
  • -104 <= xn <= 104

You can see the full challenge with visuals at this link.

Challenges • Asked over 1 year ago by Jake from AlgoDaily

Jake from AlgoDaily Commented on Oct 02, 2022:

This is the main discussion thread generated for Power of a Number (Main Thread).