Open
Conversation
oda
reviewed
Mar 23, 2026
| - n - 1 - i としている箇所は n - 1個の"()"が b に対応しているように見える。 | ||
|
|
||
| 所感 | ||
| - この解法にたどり着くまでの道のりが理解出来ない。突飛すぎると感じる。 |
There was a problem hiding this comment.
まずですね、列挙する話なので、列挙対象の全体を思い浮かべます。
でかいのでぼやけていてもいいので思い浮かべます。
列挙というのは、これをダブりヌケモレなく並べることですね。
これを手分けして並べることを考えましょう。(ここで手分けという概念を使っているのは、人間同士は他の人がやったことが見えないからですね。)なので、分類したくなります。
担当の分け方は色々あるんです。どんな分け方でも構いません。
ただ、一つの分け方として、はじめの一文字目は必ず"("だから、これに対応する")"の位置で分類することができますね。で、担当0から担当n-1までを用意して手分けします。
それぞれの担当のその先? そこは再帰するんですよ。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
問題: 22. Generate Parentheses
次に解く問題: 283. Move Zeroes
ファイルの構成:
./src/bin/<各ステップ>.rs