I had this question sent to me by a potential employer, and my answer apparently wasn't up to snuff. Can anyone help?
Implement a function that calculates power(A,B), where A and B are positive integers, assuming there is no power function in your programming language. Also, assume A and B are of Big Integer type so that there is no arithmetic overflow. What is the computational complexity of your function? Can you come up with a solution that runs with log(B) time?