Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e6d582d

Browse files
Update README.md
1 parent 19ef2e3 commit e6d582d

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎README.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1844,6 +1844,14 @@ class Solution:
18441844
```
18451845
- odd 记录上一个奇数位节点,p 记录前一个节点
18461846
- 从第3个位置开始循环,每次都把当前节点接到 odd 后面,然后跳到下一个奇数位节点继续循环
1847+
## [342. Power of Four 1行](https://leetcode.com/problems/power-of-four/)
1848+
```python
1849+
class Solution:
1850+
def isPowerOfFour(self, num: int) -> bool:
1851+
return num > 0 and not math.log(num, 4) % 1
1852+
```
1853+
- 采用 log 运算,若结果为整数则 `num` 为 4 的幂
1854+
- 整数 % 1 为 0
18471855
## [344. Reverse String 1行](https://leetcode.com/problems/reverse-string/)
18481856
```python
18491857
class Solution:

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /