AQR Capital Management interview question

Write an algorithm to calculate x^n