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

[pull] master from youngyangyang04:master #518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
pull merged 8 commits into AlgorithmAndLeetCode:master from youngyangyang04:master
Dec 30, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix: Update 1365,建议不使用built-in func作为var name
题解中使用`hash`作为变量名,而hash本身也是python3的built-in函数,故建议更改变量名
  • Loading branch information
yyccPhil authored Dec 4, 2024
commit 14223a2fa6c4a93d9e782a6b4e32e73682c5e051
8 changes: 4 additions & 4 deletions problems/1365.有多少小于当前数字的数字.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down

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