My C code accepted with 0ms


  • 4
    H
    double myPow(double x, int n){  
       if(n == 0)
         return 1;
       double t = myPow(x, n/2);
       if(n % 2 == 0)
            return t*t;
       else{
          if(n > 0)
             return x*t*t;
          else 
            return (t*t) / x;
      }
    }

  • 0
    A

    Nice Code,Study from you,thanks


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.