Skip to content

Graph bfs dfs 127#19

Open
hiroki-horiguchi-dev wants to merge 1 commit into
mainfrom
graph-bfs-dfs-127
Open

Graph bfs dfs 127#19
hiroki-horiguchi-dev wants to merge 1 commit into
mainfrom
graph-bfs-dfs-127

Conversation

@hiroki-horiguchi-dev
Copy link
Copy Markdown
Owner

127. Word Ladderを解きました、レビューお願いします。

@hiroki-horiguchi-dev hiroki-horiguchi-dev changed the title Update 127.md Graph bfs dfs 127 May 24, 2026
Comment thread graph-bfs-dns/127.md
return 0;
}

Queue<MiddleWordAndDepth> queue = new ArrayDeque<>();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

MiddleWordは個人的には見慣れない命名だと感じました。少し考えて、beginWord、endWordとの対比なのだろうと推測はできました。単にWordのほうが迷わないと感じます。
また、木というよりグラフという感じなので、Depthという言葉は似つかわしくないと思いました。問題文に合わせてLengthはどうでしょうか。
まとめると、MiddleWordAndDepthではなく、WordAndLengthとするのはどうでしょうか。

Copy link
Copy Markdown
Owner Author

@hiroki-horiguchi-dev hiroki-horiguchi-dev May 25, 2026

Choose a reason for hiding this comment

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

おっしゃる通り。。
解いている時はBFSだしDepthでええやろって思っていたんですが、一日おいてみてみるとそうですね。。
うーん、中間の言葉とその長さ、うーん。
仕事しつつ、いい命名探してみます

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