Your question is Exponentiation Power Function. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
AQR research calculations may repeatedly evaluate integer powers for signal transformations. Implement exponentiation without using Python's built-in power operators or libraries.
Given a numeric base x and an integer exponent y, return x raised to the power y. In this problem, ^ means exponentiation, not bitwise XOR.
Your solution should use exponentiation by squaring rather than multiplying by x once for every unit of the exponent. Negative exponents must return the reciprocal power.
x, a nonzero integer or floating-point number when y < 0, and y, an integer.x^y. Returning an integer for integral positive powers and a floating-point value for negative powers is acceptable.**, pow, or equivalent library functions.def power(x, y):