@@ -0,0 +1,574 @@
+// Implement pow(x, n).%0A%0Apublic class Solution %7B%0A%09// brute-force approach got TLE, need divide and conquer approach.%0A%09// brute-force: O(n)%0A%09// divide-conqueer: T(n) = T(n/2) + O(1) ---%3E O(logn)%0A    public double pow(double x, int n) %7B%0A        if(n == 1)%7B%0A            return x;%0A        %7Delse if(n == 0)%7B%0A            return 1;%0A        %7D%0A%0A        double res = pow(x, n / 2);%0A        %0A        if(n %25 2 == 0)%7B%0A            // even%0A            return res * res;%0A        %7Delse%7B%0A            // odd%0A            if(n %3C 0) x = 1 / x; %0A            return res * res * x;%0A        %7D%0A    %7D%0A%7D

add pow solution