-
Notifications
You must be signed in to change notification settings - Fork 0
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
31. Next Permutation #67
base: main
Are you sure you want to change the base?
Conversation
```python | ||
class Solution: | ||
def nextPermutation(self, nums: List[int]) -> None: | ||
def first_decreasing_index_from_right(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
関数名は動詞で始めるとよいと思います。 find_first_decreasing_index_from_right
または find_last_of_descreasing_num_index
はいかがでしょうか?
return i | ||
return -1 | ||
|
||
def next_number_index(begin, lower): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
next_number_index
ですと、次の数字インデックスを返しているように感じます。 find_minimum_number_index_larger_than
はいかがでしょうか?
index += 1 | ||
return len(nums) - 1 | ||
|
||
def swap_in_range(left, right): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
swap_in_range
ですと、何をスワップして、最終的にどのような状態にしようとしているのかが分かりにくく感じました。 reverse_in_range
のままでよいと思います。
https://leetcode.com/problems/next-permutation/