Skip to content

46. Permutations#47

Open
tom4649 wants to merge 2 commits intomainfrom
46.Permutations
Open

46. Permutations#47
tom4649 wants to merge 2 commits intomainfrom
46.Permutations

Conversation

@tom4649
Copy link
Copy Markdown
Owner

@tom4649 tom4649 commented Apr 17, 2026

Comment thread 46.Permutations/sol1.py
for i in range(len(sequence) - 1, 0, -1):
if sequence[i] <= sequence[i - 1]:
continue
for j in range(len(sequence) - 1, i - 1, -1):
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

実質外側のループを回し終えたあとの処理が、ループの内側に書かれている点に違和感を感じました。一度ループを抜けてから、この処理を書いたほうが、読み手にとって理解しやすくなると思います。

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.

なるほど、採用させていただきました。pivot変数でiを保存し、その値に応じた分岐を行うようにしました

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