Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add 147 Solution (java) #153

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Mrzhudky wants to merge 15 commits into doocs:master from Mrzhudky:master
Closed
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
6e7d386
Merge branch 'master' into work
Mrzhudky Oct 26, 2018
be11a90
correct the format mistake for 030 README.md
Mrzhudky Oct 27, 2018
02a7e68
Update Readme.md
Mrzhudky Oct 27, 2018
6c9f958
Update Solution.java
Mrzhudky Oct 27, 2018
542f73c
update format
Mrzhudky Oct 27, 2018
c779695
Update README.md
Mrzhudky Oct 27, 2018
41ea68f
Update Solution.java
Mrzhudky Oct 27, 2018
1d14f7e
try .editorconfig
Mrzhudky Oct 27, 2018
3a5299b
Merge branch 'work' of https://github.com/Mrzhudky/leetcode into work
Mrzhudky Oct 27, 2018
307d8ee
Merge branch 'work'
Mrzhudky Nov 1, 2018
c430836
Merge remote-tracking branch 'upstream1/master'
Mrzhudky Jan 9, 2019
3782264
Merge remote-tracking branch 'upstream1/master'
Mrzhudky Jan 10, 2019
5eecf74
Merge remote-tracking branch 'upstream1/master'
Mrzhudky Feb 22, 2019
ed95e77
Merge remote-tracking branch 'upstream1/master'
Mrzhudky Mar 11, 2019
1d20bc0
Add 147 Solution.java and README.md
Mrzhudky Mar 11, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update README.md
  • Loading branch information
Mrzhudky authored Oct 27, 2018
commit c779695b497a13f6fbf88e92906bcf674ccfbfd0
10 changes: 5 additions & 5 deletions solution/030.Substring with Concatenation of All Words/README.md
View file Open in desktop
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class Solution {
if(s.length() == 0 || words[0].length() == 0 || s.length() < words.length * words[0].length()) {
return re;
}
// 用< 单词,出现次数 > 来存储 words 中的元素,方便查找
// 用< 单词,出现次数 > 来存储 words 中的元素,方便查找
HashMap<String,Integer> map = new HashMap();
for (String string : words) {
map.put(string, map.getOrDefault(string,0) + 1);
Expand All @@ -64,8 +64,8 @@ class Solution {
String tempStr = s.substring(j, j + len);
if(map.containsKey(tempStr)) {
HashMap<String,Integer> searched = new HashMap<>();
// 从后向前依次对比
int tempIndex = j + lastStart;
// 从后向前依次对比
int tempIndex = j + lastStart;
String matchedStr = s.substring(tempIndex, tempIndex + len);
while (tempIndex >= j && map.containsKey(matchedStr)) {
// 正确匹配到单词
Expand All @@ -81,11 +81,11 @@ class Solution {
}
matchedStr = s.substring(tempIndex, tempIndex + len);
}
// 完全匹配所以单词
// 完全匹配所以单词
if(j > tempIndex) {
re.add(j);
}
// 从tempIndex 到 tempIndex + len 这个单词不能正确匹配
// 从tempIndex 到 tempIndex + len 这个单词不能正确匹配
else {
j = tempIndex;
}
Expand Down

AltStyle によって変換されたページ (->オリジナル) /