We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6003d69 commit c7ca5f3Copy full SHA for c7ca5f3
src/rotate_group_words/main.py
@@ -53,17 +53,22 @@ def iterating_through_input(words: list[str]) -> Any:
53
#TODO remove duplicates
54
"""
55
result_dic = {}
56
+ visited = set()
57
for w in words:
58
# instead of adding every possible words, only add those who do not have
59
# a key in dictionary
60
# finding an element inside the list of values of a key
61
# for k in result_dic.keys():
62
# if result_dic[k] == w:
63
# break
64
+ if w in visited:
65
+ continue
66
result_dic[w] = []
67
+ visited.add(w)
68
for other_word in words:
69
if is_similar(w, other_word):
70
result_dic[w].append(other_word)
71
+ visited.add(other_word)
72
# words.remove(other_word)
73
return result_dic
74
0 commit comments