Skip to content

31. Next Permutation#67

Open
hayashi-ay wants to merge 5 commits intomainfrom
hayashi-ay-patch-56
Open

31. Next Permutation#67
hayashi-ay wants to merge 5 commits intomainfrom
hayashi-ay-patch-56

Conversation

@hayashi-ay
Copy link
Copy Markdown
Owner

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

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
Copy Markdown

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
Copy Markdown

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