From 14223a2fa6c4a93d9e782a6b4e32e73682c5e051 Mon Sep 17 00:00:00 2001 From: Yuan Yuan Date: Wed, 4 Dec 2024 12:33:40 -0600 Subject: [PATCH] =?UTF-8?q?fix:=20Update=201365=EF=BC=8C=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=E4=B8=8D=E4=BD=BF=E7=94=A8built-in=20func=E4=BD=9C=E4=B8=BAvar?= =?UTF-8?q?=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 题解中使用`hash`作为变量名,而hash本身也是python3的built-in函数,故建议更改变量名 --- problems/1365.有多少小于当前数字的数字.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/problems/1365.有多少小于当前数字的数字.md b/problems/1365.有多少小于当前数字的数字.md index 22dd3226..95a270ff 100644 --- a/problems/1365.有多少小于当前数字的数字.md +++ b/problems/1365.有多少小于当前数字的数字.md @@ -144,13 +144,13 @@ public int[] smallerNumbersThanCurrent(int[] nums) { class Solution: def smallerNumbersThanCurrent(self, nums: List[int]) -> List[int]: res = nums[:] - hash = dict() + hash_dict = dict() res.sort() # 从小到大排序之后,元素下标就是小于当前数字的数字 for i, num in enumerate(res): - if num not in hash.keys(): # 遇到了相同的数字,那么不需要更新该 number 的情况 - hash[num] = i + if num not in hash_dict.keys(): # 遇到了相同的数字,那么不需要更新该 number 的情况 + hash_dict[num] = i for i, num in enumerate(nums): - res[i] = hash[num] + res[i] = hash_dict[num] return res ```