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 14223a2

Browse files
fix: Update 1365,建议不使用built-in func作为var name
题解中使用`hash`作为变量名,而hash本身也是python3的built-in函数,故建议更改变量名
1 parent 5b94b44 commit 14223a2

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎problems/1365.有多少小于当前数字的数字.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ public int[] smallerNumbersThanCurrent(int[] nums) {
144144
class Solution:
145145
def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]:
146146
res = nums[:]
147-
hash = dict()
147+
hash_dict = dict()
148148
res.sort() # 从小到大排序之后,元素下标就是小于当前数字的数字
149149
for i, num in enumerate(res):
150-
if num not in hash.keys(): # 遇到了相同的数字,那么不需要更新该 number 的情况
151-
hash[num] = i
150+
if num not in hash_dict.keys(): # 遇到了相同的数字,那么不需要更新该 number 的情况
151+
hash_dict[num] = i
152152
for i, num in enumerate(nums):
153-
res[i] = hash[num]
153+
res[i] = hash_dict[num]
154154
return res
155155
```
156156

0 commit comments

Comments
(0)

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