diff options
Diffstat (limited to 'pow_xn.cpp')
-rw-r--r-- | pow_xn.cpp | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/pow_xn.cpp b/pow_xn.cpp deleted file mode 100644 index f64161f..0000000 --- a/pow_xn.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include "leetcode.h" - -class Solution { -public: - double myPow(double x, int n) { - if (n < 0) - x = 1 / x; - long num = labs(n); - double pow = 1; - while (num) { - if (num & 1) - pow *= x; - x *= x; - num >>= 1; - } - return pow; - } -}; - -int main() {} |