File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -29,7 +29,15 @@ Output: []
29
29
30
30
## 思路
31
31
32
- 题意是
32
+ 1 . 使用HashMap来保存L中所有的字串。
33
+
34
+ 2 . 暴力破解之。使用i记录我们的查找结果字符串的位置,j记录单个单词的查找位置。j每次移动一个L中单词的位置。
35
+
36
+ 3 . 注意各种越界条件:i查到离结束还有L* N(L中所有单词总长)的时候,即需要停止。
37
+
38
+ j 也要考虑每一次查找的单词的长度。
39
+
40
+ 4 . 使用第二个HashMap来记录我们查到的单词。如果所有的单词都查到了,即可记录一个解。
33
41
34
42
``` java
35
43
@@ -38,9 +46,9 @@ Output: []
38
46
39
47
## 结语
40
48
41
- 如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[ awesome-java-leetcode] [ ajl ]
49
+ 如果你同我一样热爱数据结构、算法、LeetCode,可以关注我 GitHub 上的 LeetCode 题解:[ awesome-java-leetcode] [ zgpeace ]
42
50
43
51
44
52
45
53
[ title ] : https://leetcode.com/problems/substring-with-concatenation-of-all-words
46
- [ ajl ] : https://github.com/Blankj /awesome-java-leetcode
54
+ [ zgpeace ] : https://github.com/zgpeace /awesome-java-leetcode
You can’t perform that action at this time.
0 commit comments