Pergunta de entrevista da empresa HedgeServ

Implement the power(int b > 0, int n >= 0) function. What is its time complexity? Extend the function to also accept int n < 0. Assuming the time complexity of the implemented function was O(n), also implement an O(log n) variant. Note that use of recursion is acceptable for the O(log n) implementation, but not for the O(n) implementation. Only an iterative implementation is acceptable for the O(n) variant.