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 ec9c7c9 commit 84c8f57Copy full SHA for 84c8f57
dynamic_programming/word_break.py
@@ -64,7 +64,7 @@ def word_break(string: str, words: list[str]) -> bool:
64
raise ValueError("the words should be a list of non-empty strings")
65
66
# Build trie
67
- trie: dict[str, Any] = {}
+ trie: dict[str, dict[str, dict[str, Any] | bool]] = {}
68
word_keeper_key = "WORD_KEEPER"
69
70
for word in words:
@@ -90,7 +90,7 @@ def is_breakable(index: int) -> bool:
90
if index == len_string:
91
return True
92
93
- trie_node: Any = trie
+ trie_node = trie
94
for i in range(index, len_string):
95
trie_node = trie_node.get(string[i], None)
96
0 commit comments