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 6721b7f

Browse files
Update README.md
1 parent cf12f64 commit 6721b7f

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

‎README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2121,6 +2121,13 @@ class Solution:
21212121
- 按照从右上角到左下角的顺序遍历 matrix 的所有对角线并放入列表 temp
21222122
- 如果 对角线元素个数 是偶数则应该把 temp 反转
21232123
- 把 temp 加入结果 r
2124+
## [507. Perfect Number](https://leetcode.com/problems/perfect-number/)
2125+
```python
2126+
class Solution:
2127+
def checkPerfectNumber(self, num: int) -> bool:
2128+
return num in (6, 28, 496, 8128, 33550336, 8589869056, 137438691328, 2305843008139952128)
2129+
```
2130+
- 题目中给出了解的范围,且解的个数是固定的,因此可以提前计算出所有解
21242131
## [557. Reverse Words in a String III 1行](https://leetcode.com/problems/reverse-words-in-a-string-iii/)
21252132
```python
21262133
class Solution:

0 commit comments

Comments
(0)

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