class Solution { public: double Power(double base, int exponent) { if(exponent==0) return 1; if(exponent==1) return base; if(exponent>0) return base*Power(base, exponent-1); if(exponent<0) return (1/base)*Power(base, exponent+1); return 0; } };
class Solution { public: double Power(double base, int exponent) { if(exponent==0) return 1; if(exponent==1) return base; if(exponent>0) return base*Power(base, exponent-1); if(exponent<0) return (1/base)*Power(base, exponent+1); return 0; } };