50. Pow(x, n)
Implement pow(x, n).
public double MyPow(double x, int n) { if(n==0) return 1; double left = 1; double a = x; if(n == Int32.MinValue) { n = Int32.MinValue+1; left *= x; } int b = (n>0)?n:-1*n; while(b >1) { if( b%2 != 0) left *= a; a = a*a; b = b/2; } return (n>0)?a*left:1/(a*left); }