Solución
solution.tsTypeScript
def group_by_length(words: list[str]) -> dict[int, list[str]]:
groups = {}
for word in words:
length = str(len(word))
if length not in groups:
groups[length] = []
groups[length].append(word)
print(groups)
return groups
0respuestas