add a leetcode solution: pow(x, n).