Graph bfs dfs 127#19
Open
hiroki-horiguchi-dev wants to merge 1 commit into
Open
Conversation
jjysogfy
reviewed
May 24, 2026
| return 0; | ||
| } | ||
|
|
||
| Queue<MiddleWordAndDepth> queue = new ArrayDeque<>(); |
There was a problem hiding this comment.
MiddleWordは個人的には見慣れない命名だと感じました。少し考えて、beginWord、endWordとの対比なのだろうと推測はできました。単にWordのほうが迷わないと感じます。
また、木というよりグラフという感じなので、Depthという言葉は似つかわしくないと思いました。問題文に合わせてLengthはどうでしょうか。
まとめると、MiddleWordAndDepthではなく、WordAndLengthとするのはどうでしょうか。
Owner
Author
There was a problem hiding this comment.
おっしゃる通り。。
解いている時はBFSだしDepthでええやろって思っていたんですが、一日おいてみてみるとそうですね。。
うーん、中間の言葉とその長さ、うーん。
仕事しつつ、いい命名探してみます
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.
127. Word Ladderを解きました、レビューお願いします。