Skip to content

127 word ladder#19

Open
kitano-kazuki wants to merge 10 commits intomainfrom
127-word-ladder
Open

127 word ladder#19
kitano-kazuki wants to merge 10 commits intomainfrom
127-word-ladder

Conversation

@kitano-kazuki
Copy link
Copy Markdown
Owner

@kitano-kazuki kitano-kazuki commented Mar 9, 2026

total_words = len(copy_word_list)

visited = [False] * total_words
candidate_nodes = deque()
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

plushn/SWE-Arai60#20 (comment)

candidate という単語にあまり情報がないように思いました。自分なら BFS の未探索領域の意味で、 frontier と名付けると思います。

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]:
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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が良いと思いました


class Solution:

def group_one_word_differents_in_range(self, range_start: int, range_end: int, words: list[str]) -> list[set[str]]:
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

garunitule/coding_practice#20 (comment)

外部から参照しない変数や呼び出さないメソッドは _ を先頭につけることが多いです。self._key_to_neighbors や self._to_key などです。

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.

1 participant