Skip to content

Commit 70ae88c

Browse files
committed
Added question 212.
1 parent 2e7f1fc commit 70ae88c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

leetcode/hard/212_word_search_II.md

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,13 @@
66
- R = Number of Rows
77
- C = Number of Columns
88

9-
In order to figure out if a word exists in the list of words, it is require to do some sort of traversal on the board, generally DFS will do here.
9+
In order to figure out if a word exists in the board, it is required to do some sort of traversal on the board, generally DFS will do here.
1010
Secondly, by using a trie, we can traverse the board and trie together one character at a time.
1111

1212
Each DFS will be for the worst case, traversing the longest word in the word list.
13-
For example, a board full of a's and word list of different lengths of a's. The longest word could end up being as long as all the elements on the board.
14-
So the run-time will total to O((R \* C)^2).
13+
For example, a board full of a's and word list of different lengths of a's.
14+
The longest word could end up being as long as all the elements on the board.
15+
So the run-time will total to O((R \* C)^2) but generally this will be lower for the average case with the use of the trie.
1516

1617
```
1718
from collections import defaultdict

0 commit comments

Comments
 (0)