The good news: next permutation is not a clever trick. It is a very literal translation of what "next" means in lexicographic order. Once you see the suffix logic, you can derive the whole algorithm ...
一部の結果でアクセス不可の可能性があるため、非表示になっています。
アクセス不可の結果を表示する