Amazon interview question

Fast powOf