Skip to content
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

算法训练营(上海站)第一周作业 #2

Open
GeekUniversity opened this issue May 24, 2019 · 209 comments
Open

算法训练营(上海站)第一周作业 #2

GeekUniversity opened this issue May 24, 2019 · 209 comments

Comments

@GeekUniversity
Copy link
Contributor

GeekUniversity commented May 24, 2019

要求

  1. 每周至少完成给定题目中的两道算法题
  2. 围绕每周重点学习的算法知识点,撰写一篇有观点和思考的技术文章(字数不限)
  3. 第一周作业特别要求:根据你的理解和掌握程度,绘制一张属于你自己的数据结构和算法知识脑图。脑图请放在学习总结中一起提交。

注意事项

  1. 下面列出的题目中,按照知识点进行了简单分类,但并不意味着使用相应的数据结构或算法一定是解决该题目的最优解,这样分类只是为了方便大家有针对性的练习;
  2. 有的题目可能需要结合多个算法或数据结构进行求解。

第一周题目

数组、链表

简单:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
简单:https://leetcode-cn.com/problems/rotate-array/
简单:https://leetcode-cn.com/problems/merge-two-sorted-lists/
简单:https://leetcode-cn.com/problems/merge-sorted-array/
中等:https://leetcode-cn.com/problems/swap-nodes-in-pairs/
中等:https://leetcode-cn.com/problems/3sum/

Map & Set

简单:https://leetcode-cn.com/problems/valid-anagram/
中等:https://leetcode-cn.com/problems/group-anagrams/

堆栈、队列

简单:https://leetcode-cn.com/problems/remove-all-adjacent-duplicates-in-string/
简单:https://leetcode-cn.com/problems/remove-outermost-parentheses/
困难:https://leetcode.com/problems/largest-rectangle-in-histogram/
困难:https://leetcode.com/problems/trapping-rain-water/

二分查找

简单:https://leetcode-cn.com/problems/arranging-coins/
中等:https://leetcode-cn.com/problems/powx-n/
困难:https://leetcode-cn.com/problems/dungeon-game/

递归

简单:https://leetcode-cn.com/problems/maximum-depth-of-binary-tree/
简单:https://leetcode-cn.com/problems/symmetric-tree/
简单:https://leetcode-cn.com/problems/minimum-depth-of-binary-tree/
简单:https://leetcode-cn.com/problems/minimum-distance-between-bst-nodes/
简单:https://leetcode-cn.com/problems/binary-tree-paths/
简单:https://leetcode-cn.com/problems/range-sum-of-bst/
中等:https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/

作业提交规则

  1. 在提交作业之前,请先阅读这里的 README 文档:
    https://github.com/algorithm002/algorithm/blob/master/README.md
  2. 然后在此 Issues 下按照如下格式回复(示例见一楼):

#作业提交
学号:
username:
代码作业:(填写自己仓库下对应的作业链接即可,同时记得给本仓库提交 pull request)
学习总结:发表自己本周的学习感言 issues,并提交链接,issues 标题格式:“【学号后三位-week1】+文章标题”,格式参考:#1
使用语言:

@GeekUniversity
Copy link
Contributor Author

GeekUniversity commented May 24, 2019

#作业提交
学号:000
username:GeekUniversity
代码作业:https://github.com/GeekUniversity/assignment01/blob/master/helloworld.py
学习总结:#1
使用语言:Python

@GeekUniversity
Copy link
Contributor Author

#作业提交
学号:000
username:GeekUniversity
代码作业:https://github.com/GeekUniversity/assignment01/blob/master/helloworld.py
学习总结:#1
使用语言:Python

(通过Quote reply,在这里写下你对某位同学代码作业或学习总结的点评)

@zyziyun
Copy link

zyziyun commented Jun 4, 2019

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/zyziyun/algorithm/tree/week1/Week_01/id_39
学习总结:#15
使用语言:JavaScript
PR: https://github.com/algorithm002/algorithm/pull/5/files

@James-Ren
Copy link
Contributor

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/algorithm002/algorithm/pull/5/files (PR更容易看?)
学习总结:待完成
使用语言:JavaScript
(未完,试一下格式是否正确)

我略懂些javascript,看到您的代码,思路清晰,还有注释也很全,唯一的问题是好像代码文件命名不符合规则,没有把学号写进去,可参照仓库README的注意事项第1条:代码文件命名规则

@zyziyun
Copy link

zyziyun commented Jun 7, 2019

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/algorithm002/algorithm/pull/5/files (PR更容易看?)
学习总结:待完成
使用语言:JavaScript
(未完,试一下格式是否正确)

我略懂些javascript,看到您的代码,思路清晰,还有注释也很全,唯一的问题是好像代码文件命名不符合规则,没有把学号写进去,可参照仓库README的注意事项第1条:代码文件命名规则

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/algorithm002/algorithm/pull/5/files (PR更容易看?)
学习总结:待完成
使用语言:JavaScript
(未完,试一下格式是否正确)

我略懂些javascript,看到您的代码,思路清晰,还有注释也很全,唯一的问题是好像代码文件命名不符合规则,没有把学号写进去,可参照仓库README的注意事项第1条:代码文件命名规则

好的,我改一下,命名规则看漏了

@James-Ren
Copy link
Contributor

#作业提交
学号:010
username:James-Ren
代码作业:https://github.com/James-Ren/algorithm/tree/master/Week_01/id_10
学习总结:#10
使用语言:Python,Go

@James-Ren
Copy link
Contributor

#作业提交
学号:041
username:jianywu
代码作业:https://github.com/Fanlu91/algorithm/tree/master/Week_01/id_41
学习总结:#7
使用语言:Cpp

我不是很懂C++,但是现在没有其他的代码可以review,所以我点进去想看看您的代码,不过目前很遗憾,您的目录里面没有看到代码文件。

@theonerk
Copy link

theonerk commented Jun 7, 2019

#作业提交
学号:013
username:rongk
代码作业:https://github.com/theonerk/algorithm/tree/master/Week_01/id_13
学习总结:none
使用语言:nodejs

代码作业在github的链接:
https://github.com/theonerk/algorithm/tree/master/Week_01/id_13

@maxyzli
Copy link
Contributor

maxyzli commented Jun 8, 2019

作业提交

学号:029
username:LIYINGZHEN
代码作业:#16
学习总结:#29
算法腦圖:腦圖
使用语言:Golang

@maxyzli
Copy link
Contributor

maxyzli commented Jun 8, 2019

#作业提交
学号:010
username:James-Ren
代码作业:James-Ren/algorithm:Week_01/id_10@master
学习总结:#10
使用语言:Python,Go

我就看了 Go 的部分, 感謝提供第 42 題思路。

@hhf666feng
Copy link
Contributor

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python

@jianywu
Copy link
Contributor

jianywu commented Jun 8, 2019

#作业提交
学号:041
username:jianywu
代码作业:https://github.com/jianywu/algorithm/tree/master/Week_01/id_41
Pull Request: #8
学习总结:#7
使用语言:C++
算法脑图:https://github.com/jianywu/algorithm/blob/master/algo.png

@Shockang
Copy link
Contributor

Shockang commented Jun 8, 2019

#作业提交
学号:012
username:Shockang
代码作业:https://github.com/Shockang/algorithm/tree/master/Week_01/id_12
学习总结:https://github.com/Shockang/algorithm/blob/master/Week_01/id_12/学习总结.md
算法脑图:https://github.com/Shockang/algorithm/blob/master/Week_01/id_12/数据结构与算法.xmind
使用语言:Java

@James-Ren
Copy link
Contributor

作业提交

学号:029
username:LIYINGZHEN
代码作业:#16
学习总结:TODO
使用语言:Golang

看了您的链表题的做法,用dummy node果然可以简化很多代码,学习了,谢谢。
提个小建议,针对int的max函数Go标准库没有提供,可以手写一个,比int转成float64,再转回int更好点。我看了别人的代码,自己手写了一个,也不麻烦。

@James-Ren
Copy link
Contributor

James-Ren commented Jun 8, 2019

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python

看来我不是很了解dummy node的用法,链表题我要多练练。python的数组可以直接pop出最后一个元素,当stack使用。学到了,谢谢。
没想到你刷了这么多题目,效率真高。

@James-Ren
Copy link
Contributor

#作业提交
学号:013
username:rongk
代码作业:https://github.com/theonerk/algorithm/tree/master/Week_01/id_13
学习总结:none
使用语言:nodejs

代码作业在github的链接:
https://github.com/theonerk/algorithm/tree/master/Week_01/id_13

有些题的做法给了我新的思路,学习了,谢谢。

@liveForExperience
Copy link
Contributor

#作业提交
学号:018
username:liveForExperience
代码作业:https://github.com/liveForExperience/algorithm/tree/master/Week_01/id_18
学习总结:#20
使用语言:Java

@thisyears
Copy link
Contributor

#作业提交
学号:022
username:jzq
代码作业:https://github.com/thisyears/algorithm/tree/master/Week_01/id_22
学习总结:#26
使用语言:JavaScript

@mayon
Copy link

mayon commented Jun 9, 2019

#作业提交
学号:024
username:Mayon
代码作业:https://github.com/mayon/algorithm/tree/master/Week_01/id_24
学习总结:#25
使用语言:Python

@James-Ren
Copy link
Contributor

#作业提交
学号:024
username:Mayon
代码作业:https://github.com/mayon/algorithm/tree/master/Week_01/id_24
学习总结:#25
使用语言:Python

leecode 441 还能这么写,给了我新思路,学习了,谢谢

@duoyuli
Copy link
Contributor

duoyuli commented Jun 9, 2019

#作业提交
学号:009
username:hiColors
代码作业:https://github.com/hiColors/algorithm/tree/master/Week_01/id_9
学习总结:#34
使用语言:Java

@liveForExperience
Copy link
Contributor

#作业提交
学号:012
username:Shockang
代码作业:Shockang/algorithm:Week_01/id_12@master
学习总结:https://github.com/Shockang/algorithm/blob/master/Week_01/id_12/学习总结.md
算法脑图:https://github.com/Shockang/algorithm/blob/master/Week_01/id_12/数据结构与算法.xmind
使用语言:Java

您好,您第15题的解题过程平铺直叙,简单易懂,参考您的解题过程对我解这道题目非常有帮助。非常感谢。

@AAluoxiang
Copy link
Contributor

#作业提交
学号:001
username:AAluoxiang
代码作业:https://github.com/AAluoxiang/algorithm/tree/master/Week_01/id_1
学习总结:#36
使用语言:Java

@xiaoluome
Copy link
Contributor

#作业提交
学号:036
username:xiaoluome
代码作业:https://github.com/xiaoluome/algorithm/tree/master/Week_01/id_36
学习总结:#40
使用语言:Python

@jianywu
Copy link
Contributor

jianywu commented Jun 9, 2019

作业提交

学号:029
username:LIYINGZHEN
代码作业:#16
学习总结:TODO
使用语言:Golang

看了您的链表题的做法,用dummy node果然可以简化很多代码,学习了,谢谢。
提个小建议,针对int的max函数Go标准库没有提供,可以手写一个,比int转成float64,再转回int更好点。我看了别人的代码,自己手写了一个,也不麻烦。

貌似C语言也没提供,不过没试着自己去实现,而是转用cpp了。。
static inline int max(int a, int b)
{
return (a > b) ? a : b;
}

@jianywu
Copy link
Contributor

jianywu commented Jun 9, 2019

#作业提交
学号:024
username:Mayon
代码作业:https://github.com/mayon/algorithm/tree/master/Week_01/id_24
学习总结:#25
使用语言:Python

leecode 441 还能这么写,给了我新思路,学习了,谢谢

441也学习了,不过没看懂。。

@lection
Copy link
Contributor

lection commented Jun 9, 2019

#作业提交
学号:003
username:lection
代码作业:https://github.com/lection/algorithm-1/tree/master/Week_01/id_3
学习总结:#42
使用语言:Python3

@XueminZhu
Copy link
Contributor

#作业提交
学号:020
username:hz019
代码作业:https://github.com/algorithm002/algorithm/tree/master/Week_01/id_20
学习总结:#59
使用语言:Python,javascript

个人觉得mergeTwoLists的操作长了点

@wuxizhi777
Copy link

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python

学习了镜像树的解题思路

不知道为啥我点进去是404
确实是,代码没有传进入么?

@wuxizhi777
Copy link

#作业提交
学号:023
username:Eva
代码作业:https://github.com/hiveryeah/algorithm/tree/master/Week_01/id_23
学习总结:https://github.com/hiveryeah/algorithm/blob/master/Week_01/id_23/NOTE.md
使用语言:Java

removeDuplicates解法很妙

赞一个

@wuxizhi777
Copy link

#作业提交
学号:001
username:AAluoxiang
代码作业:AAluoxiang/algorithm:Week_01/id_1@master
学习总结:#36
使用语言:Java

解了好多題,很多可以借鑒參考 🤝

厉害。厉害,赞一个。

@wuxizhi777
Copy link

#作业提交
学号:025
username:g29times
代码作业:https://github.com/g29times/algorithm/tree/master/Week_01/id_25
学习总结:https://github.com/g29times/algorithm/blob/master/Week_01/id_25/NOTE.md
使用语言:Java

赞一个

@wuxizhi777
Copy link

#作业提交
学号:023
username:Eva
代码作业:https://github.com/hiveryeah/algorithm/tree/master/Week_01/id_23
学习总结:https://github.com/hiveryeah/algorithm/blob/master/Week_01/id_23/NOTE.md
使用语言:Java

赞一个。

@zzhengjian
Copy link

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/zyziyun/algorithm/tree/week1/Week_01/id_39
学习总结:#15
使用语言:JavaScript
PR: https://github.com/algorithm002/algorithm/pull/5/files

佩服毅力啊,能完成这么多作业,还能挑战高难度题目。而且能对一个题目作出多种解法,向你学习。

@zzhengjian
Copy link

#作业提交
学号:012
username:Shockang
代码作业:https://github.com/Shockang/algorithm/tree/master/Week_01/id_12
学习总结:https://github.com/Shockang/algorithm/blob/master/Week_01/id_12/学习总结.md
算法脑图:https://github.com/Shockang/algorithm/blob/master/Week_01/id_12/数据结构与算法.xmind
使用语言:Java

格式很合乎规范,就是直接用recursion 这样做方法名是不是不太好,哈哈。

@zzhengjian
Copy link

#作业提交
学号:035
username:XueminZhu
代码作业:https://github.com/GitGarden2019/leecode/tree/master/src/com/leecode/week01
学习总结: #265
使用语言:JAVA

位运算解决思路很不错,赞一个。

@zzhengjian
Copy link

#作业提交
学号:042
username:wuxizhi777
代码作业: https://github.com/wuxizhi777/algorithm/tree/master/Week_01/id_42
学习总结:#42
使用语言:java

第一周就挑战高难度,佩服佩服。

@mcgread
Copy link
Contributor

mcgread commented Jul 14, 2019

#作业提交
学号:003
username:lection
代码作业:https://github.com/lection/algorithm-1/tree/master/Week_01/id_3
学习总结:#42
使用语言:Python3

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python

学习了镜像树的解题思路

不知道为啥我点进去是404
确实是,代码没有传进入么?
我看了一下,404是因为他fork的仓库删了

@mcgread
Copy link
Contributor

mcgread commented Jul 14, 2019

#作业提交
学号:041
username:jianywu
代码作业:https://github.com/jianywu/algorithm/tree/master/Week_01/id_41
Pull Request: #8
学习总结:#7
使用语言:C++
算法脑图:https://github.com/jianywu/algorithm/blob/master/algo.png

看你的每一题的代码都挺简洁的,学习了,谢谢

@mcgread
Copy link
Contributor

mcgread commented Jul 14, 2019

#作业提交
学号:010
username:James-Ren
代码作业:https://github.com/James-Ren/algorithm/tree/master/Week_01/id_10
学习总结:#10
使用语言:Python,Go

同学用了两种语言,挺厉害的

@mcgread
Copy link
Contributor

mcgread commented Jul 14, 2019

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python
好厉害,一周的作业都刷完了,赞一个!

@mcgread
Copy link
Contributor

mcgread commented Jul 14, 2019

#作业提交
学号:030
username:tripleSim
代码作业:https://github.com/tripleSim/algorithm/tree/master/Week_01/id_30
学习总结: #50
使用语言:C++

同样是用cpp写的代码,感觉你写的比我好多了

@Jerrydreamaker
Copy link
Contributor

作业提交

学号:029
username:LIYINGZHEN
代码作业:#16
学习总结:#29
算法腦圖:腦圖
使用语言:Golang

脑图很棒哦,学习了。

@Jerrydreamaker
Copy link
Contributor

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/algorithm002/algorithm/pull/5/files (PR更容易看?)
学习总结:待完成
使用语言:JavaScript
(未完,试一下格式是否正确)

我略懂些javascript,看到您的代码,思路清晰,还有注释也很全,唯一的问题是好像代码文件命名不符合规则,没有把学号写进去,可参照仓库README的注意事项第1条:代码文件命名规则

不错不错,学习了。

@Jerrydreamaker
Copy link
Contributor

#作业提交
学号:030
username:tripleSim
代码作业:https://github.com/tripleSim/algorithm/tree/master/Week_01/id_30
学习总结: #50
使用语言:C++

同样是用cpp写的代码,感觉你写的比我好多了

写得挺好的。

@Jerrydreamaker
Copy link
Contributor

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python
好厉害,一周的作业都刷完了,赞一个!
这题量,厉害了。

@Jerrydreamaker
Copy link
Contributor

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python
好厉害,一周的作业都刷完了,赞一个!
这题量,厉害了。

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/algorithm002/algorithm/pull/5/files (PR更容易看?)
学习总结:待完成
使用语言:JavaScript
(未完,试一下格式是否正确)

我略懂些javascript,看到您的代码,思路清晰,还有注释也很全,唯一的问题是好像代码文件命名不符合规则,没有把学号写进去,可参照仓库README的注意事项第1条:代码文件命名规则

厉害了,学习。

@confidence93
Copy link
Contributor

#作业提交
学号:014
username:confidence93
代码作业:https://github.com/confidence93/algorithm/tree/master/Week_01/id_14
学习总结: #302
使用语言:Python

@confidence93
Copy link
Contributor

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/zyziyun/algorithm/tree/week1/Week_01/id_39
学习总结:#15
使用语言:JavaScript
PR: https://github.com/algorithm002/algorithm/pull/5/files

#作业提交
学号:010
username:James-Ren
代码作业:https://github.com/James-Ren/algorithm/tree/master/Week_01/id_10
学习总结:#10
使用语言:Python,Go

最近在学GO,从您代码里学习了

@confidence93
Copy link
Contributor

#作业提交
学号:001
username:AAluoxiang
代码作业:https://github.com/AAluoxiang/algorithm/tree/master/Week_01/id_1
学习总结:#36
使用语言:Java

学习了

@confidence93
Copy link
Contributor

#作业提交
学号:024
username:Mayon
代码作业:https://github.com/mayon/algorithm/tree/master/Week_01/id_24
学习总结:#25
使用语言:Python

厉害厉害

@confidence93
Copy link
Contributor

1 similar comment
@swelily
Copy link

swelily commented Jul 16, 2019

@swelily
Copy link

swelily commented Jul 16, 2019

#作业提交
学号:024
username:Mayon
代码作业:https://github.com/mayon/algorithm/tree/master/Week_01/id_24
学习总结:#25
使用语言:Python

厉害厉害

有启发

@swelily
Copy link

swelily commented Jul 16, 2019

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python
好厉害,一周的作业都刷完了,赞一个!
这题量,厉害了。

#作业提交
学号:039
username:ziyun
代码作业:https://github.com/algorithm002/algorithm/pull/5/files (PR更容易看?)
学习总结:待完成
使用语言:JavaScript
(未完,试一下格式是否正确)

我略懂些javascript,看到您的代码,思路清晰,还有注释也很全,唯一的问题是好像代码文件命名不符合规则,没有把学号写进去,可参照仓库README的注意事项第1条:代码文件命名规则

厉害了,学习。

很认真

@swelily
Copy link

swelily commented Jul 16, 2019

#作业提交
学号:026
username:huanghaifeng
代码作业:https://github.com/hhf666feng/algorithm/tree/master/Week_01/id_26
学习总结: #17
使用语言:Python
好厉害,一周的作业都刷完了,赞一个!
这题量,厉害了。

很认真

@swelily
Copy link

swelily commented Jul 16, 2019

#作业提交
学号:041
username:jianywu
代码作业:https://github.com/jianywu/algorithm/tree/master/Week_01/id_41
Pull Request: #8
学习总结:#7
使用语言:C++
算法脑图:https://github.com/jianywu/algorithm/blob/master/algo.png

看你的每一题的代码都挺简洁的,学习了,谢谢

简洁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests