Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
de4673c
测试push
spareribs Dec 5, 2018
4a913d0
Update readme.md
simkakashi Dec 6, 2018
8148be9
Add files via upload
simkakashi Dec 7, 2018
a6da733
Merge pull request #14 from MU-CHEN-CHEN/master
Light-City Dec 7, 2018
2848a3d
second commit
ParkFeng Dec 7, 2018
ab20a48
the first week on leetcode
Majingmin Dec 8, 2018
b1d171c
add the readme
Majingmin Dec 8, 2018
66ce671
Merge pull request #15 from Majingmin/master
Light-City Dec 8, 2018
a54cd00
update
Majingmin Dec 8, 2018
52512ea
Merge branch 'master' of github.com:guangcity/learning-algorithm
spareribs Dec 8, 2018
274bdc3
SugarChl-pr
SugarChl Dec 8, 2018
45acb3c
Update readme.md
SugarChl Dec 8, 2018
e32e8d8
new-pr
Dec 8, 2018
891d826
Create readme.md
missannas Dec 8, 2018
5b4e24d
Create al.c
missannas Dec 8, 2018
3349f8a
Create al.c
missannas Dec 8, 2018
eb3543e
Create al.java
missannas Dec 8, 2018
4ebb942
Create al.py
missannas Dec 8, 2018
f8ec484
Delete al.c
missannas Dec 8, 2018
29dbe2d
task2
liuguang1 Dec 8, 2018
2a990d8
情感丰富的文字
LeafScar Dec 8, 2018
41e0b96
情感丰富的文字
LeafScar Dec 8, 2018
192c095
leetcode
kevinnewkevin Dec 8, 2018
507a41d
Merge pull request #22 from liuguang1/master
Majingmin Dec 8, 2018
b267e5d
Merge pull request #23 from LeafScar/master
Majingmin Dec 8, 2018
b0b2a65
Merge pull request #24 from kevinnewkevin/learn
Majingmin Dec 8, 2018
64f9932
Merge pull request #20 from missannas/test-pr
Majingmin Dec 8, 2018
9b41fda
Merge pull request #19 from duyupeng/new-pr
Majingmin Dec 8, 2018
1956033
Merge pull request #18 from SugarChl/SugarChl-pr
Majingmin Dec 8, 2018
a8ce7e6
Merge pull request #16 from simkakashi/master
Majingmin Dec 8, 2018
2441cdc
update
Majingmin Dec 8, 2018
1b0d026
slove conflict
Majingmin Dec 8, 2018
8d00a87
Merge pull request #25 from ParkFeng/master
Majingmin Dec 8, 2018
e27bee0
longestSubString
Ye980226 Dec 8, 2018
74530ca
20181208 LeetCode - 33. Search in Rotated Sorted Array
awyd234 Dec 8, 2018
eb9f578
Merge branch 'master' of github.com:guangcity/learning-algorithm
awyd234 Dec 8, 2018
bd12f85
Merge pull request #27 from awyd234/master
Majingmin Dec 9, 2018
9d24088
Merge pull request #26 from Ye980226/master
Majingmin Dec 9, 2018
3fe6d9e
update
Majingmin Dec 9, 2018
1b578cb
Merge pull request #28 from Majingmin/master
Majingmin Dec 9, 2018
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
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
################################################################################
# 此 .gitignore 文件已由 Microsoft(R) Visual Studio 自动创建。
################################################################################

*.suo
*.db
*.opendb
*.json
*.sqlite
205 changes: 156 additions & 49 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions HughGuo/Leetcode-02/C003_无重复字符的最长子串.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Solution:
def lengthOfLongestSubstring(self, s):
"""
:type s: str
:rtype: int
"""
temp = 0
d = {}
start = 0
for i in range(len(s)):
if s[i] in d and start <= d[s[i]] :
start = d[s[i]] +1
temp = max(i-start+1,temp)
d[s[i]] = i
return temp

## 维护两个字符串,一个是当前最大的字符串l,一个是当前字符串t,最初的时候这两个字符串都为空。每扫一个字符,如果这个字符不在字符串当中,就把当前字符串加上这个字符。如果在,当前字符串就不能再往前加字符了,然后比较当前字符串和当前最大字符串。再把当前字符串的开始地址替换掉因为不能有重复元素,##麻烦
## 滑动窗口! 机智!
3 changes: 2 additions & 1 deletion HughGuo/readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# HughGuo贡献内容

- 两数求和
- #2. 两数求和
- #3. 无重复字符的最长子串
48 changes: 48 additions & 0 deletions LeafScar/expressive_words/expressive_words.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <vector>

using namespace std;

class Solution {
public:
int expressiveWords(string S, std::vector<string>& words) {
int num = 0;
for (int i = 0; i < words.size(); ++i)
{
if (expressiveWord(S, words[i]))
num++;
}
return num;
}

bool expressiveWord(string s, string t)
{
int s_i = 0;
int t_i = 0;

while (s_i < s.length() && t_i < t.length())
{
if (s[s_i] != t[t_i])
return false;

int s_flag = 0;
while (s[s_i] == t[t_i])
{
s_i++;
s_flag++;
}

int t_flag = 0;
while (s[s_i - 1] == t[t_i])
{
t_flag++;
t_i++;
}

if (t_flag == s_flag || (s_flag >= 3 && t_flag <= s_flag))
continue;

return false;
}
return s_i == s.length() && t_i == t.length();
}
};
Binary file added LeafScar/expressive_words/file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading