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 efc0388 commit eaba103Copy full SHA for eaba103
note/030/README.md
@@ -27,7 +27,8 @@ Output: []
27
**Tags:** Hash Table, Two Pointers, String
28
29
30
-## 思路
+## 思路 0
31
+遍历string的字符串,挨个匹配,O(n*wordLength)
32
33
1. 使用HashMap来保存L中所有的字串。
34
@@ -89,6 +90,27 @@ class Solution {
89
90
}
91
92
93
+```
94
+
95
+## 思路 1
96
+通过滑动窗口的思维,窗口大小为words数组的1个单位。
97
98
+An O(N) solution with detailed explanation
99
100
+1. travel all the words combinations to maintain a window
101
102
+2. there are wl(word len) times travel
103
104
+3. each time, n/wl words, mostly 2 times travel for each word
105
106
+4. one left side of the window, the other right side of the window
107
108
+5. so, time complexity O(wl * 2 * N/wl) = O(2N)
109
110
111
+```java
112
113
114
```
115
116
0 commit comments