Thursday, July 10, 2014

[Leetcode] Pow(x, n)

Problem

Implement pow(xn).

Algorithm

Note, n might be negative. Take an absolute value of n, and finally return 1/res;
When n is Integer.min_value, abs(Integer.min) = Integer.min. 

Code






No comments:

Post a Comment