class Solution { private: double multiplay(double x, int n){ if(n == 0) return 1; double tmp = multiplay(x, n / 2); return n % 2 ? tmp * x * tmp : tmp * tmp; } public: double Power(double base, int exponent) { return exponent >=0 ? multiplay(base,exponent):1 /multiplay(base, -exponent); } };