result
to store the words that can be transformed.query
in the queries
array.query
, iterate over each word dict_word
in the dictionary
array.diff_count
to 0.query
and dict_word
at each index.diff_count
.diff_count
exceeds 2, break the inner loop as more than two edits are required.diff_count
is less than or equal to 2 after comparing all characters, add query
to result
and break the inner loop.result
list.