Back to DSA sheet

Pow(x, n)

MediumMath
Open on LeetCodeAmazonGoogleMicrosoft

Implement x raised to the power n (x^n), where n can be negative.

Constraints
  • -100 < x < 100
  • -2^31 <= n <= 2^31 - 1
Sheets
Blind 75Grind 75NeetCode 150NeetCode 250Striver A2Z
pow-x-n.cpp
Loading editor
Custom input (stdin)
Output

Run your code to see its output.