Easy · Math

Power X of Y

Given a signed 64-bit base and integer exp ≤ 100, return base raised to the power exp: 1 when exp is 0 (0^0 included) and 0 when exp is negative. For nonnegative exp, the result is guaranteed to fit in a signed 64-bit integer.

Examples

Example 1

{
  "base": 2,
  "exp": 10
}

Output: = 1024

Example 2

{
  "base": 3,
  "exp": 5
}

Output: = 243

Rebuild it in the studio

Open every published interview problem, solution, scene, and memory room free, with no account.

More Math problems