Skip to content

Add Solution and Readme.md for 30[Java] #62

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

Merged
merged 2 commits into from
Oct 26, 2018
Merged

Add Solution and Readme.md for 30[Java] #62

merged 2 commits into from
Oct 26, 2018

Conversation

Mrzhudky
Copy link
Contributor

Correct my error in Readme.md for 029, and Add Solution and Readme.md for 30[Java]

Copy link
Member

@yanglbme yanglbme left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我先 merge 啦,后面你方便的话,可以修改一下噢😄

words = ["word","good","good"]
(ps:原题的例子为 words = ["word","student"] 和题目描述不符,这里私自改了一下)
输出: []
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😁一点小建议噢,代码块的添加与 LeetCode 保持一致:示例字体加粗,输入输出用代码块包围。
e.g.

示例 1:

输入:
  s = "barfoothefoobarman",
  words = ["foo","bar"]
输出: [0,9]
解释: 从索引 0 和 9 开始的子串分别是 "barfoor" 和 "foobar" 。
输出的顺序不重要, [9,0] 也是有效答案。

示例 2:

输入:
  s = "wordgoodstudentgoodword",
  words = ["word","student"]
输出: []

if(s.length() == 0 || words[0].length() == 0 || s.length() < words.length * words[0].length()) {
return re;
}
// 用< 单词,出现次数 > 来存储 words 中的元素,方便查找
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释的缩进与代码保持一致~

if(map.containsKey(tempStr)) {
HashMap<String,Integer> searched = new HashMap<>();
// 从后向前依次对比
int tempIndex = j + lastStart;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里缩进得有点多噢~是不是贴过来的时候乱了(⊙o⊙)?

后面代码注释也有缩进的问题。

@yanglbme yanglbme merged commit baf4776 into doocs:master Oct 26, 2018
@yanglbme yanglbme added the need optimization Improvement request label Oct 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need optimization Improvement request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants