You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leetcode/hard/212_word_search_II.md
+4-3Lines changed: 4 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,13 @@
6
6
- R = Number of Rows
7
7
- C = Number of Columns
8
8
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.
10
10
Secondly, by using a trie, we can traverse the board and trie together one character at a time.
11
11
12
12
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.
0 commit comments