Amazon Interview Question

Apply power function. Basic algorithms.