Skip to content

Commit f24fe1e

Browse files
author
lucifer
committed
fix: typo
1 parent aafccd8 commit f24fe1e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

problems/50.pow-x-n.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ class Solution:
9494
return self.myPow(x, n // 2) * self.myPow(x, n - n // 2)
9595
```
9696

97-
### 代码
98-
9997
## 解法二 - 优化递归
10098

10199
### 思路
@@ -148,6 +146,8 @@ class Solution:
148146
- 将 n 的二进制表示中`1的位置`pick 出来。比如 n 的第 i 位为 1,那么就将 x^i pick 出来。
149147
- 将 pick 出来的结果相乘
150148

149+
![](https://tva1.sinaimg.cn/large/006tNbRwly1gbdtiky90rj30vq0hcab4.jpg)
150+
151151
这里有两个问题:
152152

153153
第一个问题是`似乎我们需要存储 x^i 以便后续相乘的时候用到`。实际上,我们并不需要这么做。我们可以采取一次遍历的方式来完成,具体看代码。

0 commit comments

Comments
 (0)