Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

31. Next Permutation #67

wants to merge 5 commits into from

Conversation

hayashi-ay
Copy link
Owner

```python
class Solution:
def nextPermutation(self, nums: List[int]) -> None:
def first_decreasing_index_from_right():
Copy link

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):
Copy link

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):
Copy link

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 のままでよいと思います。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants