Skip to content

31. Next Permutation#59

Open
kitano-kazuki wants to merge 1 commit into
mainfrom
31-next-permutation
Open

31. Next Permutation#59
kitano-kazuki wants to merge 1 commit into
mainfrom
31-next-permutation

Conversation

@kitano-kazuki
Copy link
Copy Markdown
Owner

Comment thread memo.md
Comment on lines +95 to +97
if nums[i] >= nums[i + 1]:
continue
return i
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if nums[i] < nums[i + 1]:
        return i

とする方が良いと思いました

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

これ自分も迷いました。
nums[i] >= nums[i+1]
だったらスルーするみたいなのがわかるようにしたかったという意図です。

でもコード量少ないほうがいいという見方もありますよね

Comment thread memo.md

def swap(self, nums: list[int], i: int, j: int) -> None:
nums[i], nums[j] = nums[j], nums[i]
return
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

returnをつけない方が自分は好みです

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants