From 8c538a27c9983fae99a0a854c8405f96f88026f5 Mon Sep 17 00:00:00 2001 From: SquidSpirit Date: Tue, 18 Mar 2025 22:33:27 +0800 Subject: [PATCH] refactor: rename variable --- 50_pow_x_n/main.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/50_pow_x_n/main.cpp b/50_pow_x_n/main.cpp index 83ea728..611682d 100644 --- a/50_pow_x_n/main.cpp +++ b/50_pow_x_n/main.cpp @@ -7,7 +7,7 @@ class Solution { if (x == 0) return 0; if (n == 0) return 1; - bool isNeg = n < 0; + bool isExpNeg = n < 0; n = abs(n); int logn = (int)log2(n); @@ -24,7 +24,7 @@ class Solution { n >>= 1; } - if (isNeg) result = 1.0 / result; + if (isExpNeg) result = 1.0 / result; return result; } @@ -44,9 +44,9 @@ class Solution { x^10 -x^8 1 -x^4 0 -x^2 1 -x^1 0 +x^8 x^(2^3) 1 +x^4 x^(2^2) 0 +x^2 x^(2^1) 1 +x^1 x^(2^0) 0 */