7 kyu
The Power of Exponents
108 of 608Zedenem
Description:
This kata is based on: Exponent Method
Create a method called power
that takes two integers and returns the value of the first argument raised to the power of the second.
Unlike the Exponent Method, you should also take in account negative exponents.
Your solution won't be tested against special cases leading to undefined values (0**-2
for example)
Note: The **
operator (JS: Math.pow
) has been disabled.
Examples:
power(2, 3) # 8
power(4, -2) # 0.0625
Mathematics
Algorithms
Similar Kata:
Stats:
Created | Mar 17, 2014 |
Published | Mar 17, 2014 |
Warriors Trained | 1046 |
Total Skips | 29 |
Total Code Submissions | 2245 |
Total Times Completed | 608 |
Ruby Completions | 108 |
JavaScript Completions | 515 |
Total Stars | 12 |
% of votes with a positive feedback rating | 85% of 165 |
Total "Very Satisfied" Votes | 125 |
Total "Somewhat Satisfied" Votes | 31 |
Total "Not Satisfied" Votes | 9 |
Total Rank Assessments | 41 |
Average Assessed Rank | 6 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 8 kyu |