To learn more about the newsletter, check our detailed About Page + FAQs
To help me understand you better, please fill out this anonymous, 2-min survey. If you liked this post, make sure you hit the heart icon in this email.
Get a free Weekly Summary of the important updates in AI and Machine Learning here
Recommend this publication to Substack over here
Take the next step by subscribing here
What is the difference between a guitar and a fish,
You can tune a guitar but can't Tuna Fish. You can thank Google Assistant for that gem. To those of you wondering about the newsletter giveaway, it will happen around the first or second week of Jan. This will give me some time to wrap up some collaborations I’m working on. For more details about the newsletter giveaway, please refer to my announcement post.
Back to the question at hand.
This can be found as Problem 50. Pow(x, n) on Leetcode
Problem
Implement pow(x, n), which calculates x
raised to the power n
(i.e., xn
).
Example 1:
Input: x = 2.00000, n = 10
Output: 1024.00000
Example 2:
Input: x = 2.10000, n = 3
Output: 9.26100
Example 3:
Input: x = 2.00000, n = -2
Output: 0.25000
Explanation: 2-2 = 1/22 = 1/4 = 0.25
Constraints:
-100.0 < x < 100.0
-231 <= n <= 231-1
n
is an integer.
-10^4 <= x^n <= 10^4
Keep reading with a 7-day free trial
Subscribe to Technology Made Simple to keep reading this post and get 7 days of free access to the full post archives.