Open
Conversation
kitano-kazuki
commented
Mar 9, 2026
| total_words = len(copy_word_list) | ||
|
|
||
| visited = [False] * total_words | ||
| candidate_nodes = deque() |
Owner
Author
There was a problem hiding this comment.
plushn/SWE-Arai60#20 (comment)
candidate という単語にあまり情報がないように思いました。自分なら BFS の未探索領域の意味で、 frontier と名付けると思います。
kitano-kazuki
commented
Mar 9, 2026
| class Solution: | ||
| def get_word_to_adjacents_dict(self, word_list: list[str]) -> dict[str, list[str]]: | ||
|
|
||
| def yield_one_alphabet_replaced(word: str) -> Generator[str, None, None]: |
Owner
Author
There was a problem hiding this comment.
garunitule/coding_practice#20 (comment)
少し悩んだのですが、
Simple generators that only ever yield values can also be annotated as having a return type of either
という記述があったので、Iteratorを選択しました
SendTypeやReturnTypeがある場合はGeneratorが良いと思いました
kitano-kazuki
commented
Mar 9, 2026
|
|
||
| class Solution: | ||
|
|
||
| def group_one_word_differents_in_range(self, range_start: int, range_end: int, words: list[str]) -> list[set[str]]: |
Owner
Author
There was a problem hiding this comment.
garunitule/coding_practice#20 (comment)
外部から参照しない変数や呼び出さないメソッドは _ を先頭につけることが多いです。self._key_to_neighbors や self._to_key などです。
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.
https://leetcode.com/problems/word-ladder/description/