Skip to content

算法训练营第一周作业 #1

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

Open
GeekUniversity opened this issue Mar 26, 2019 · 179 comments
Open

算法训练营第一周作业 #1

GeekUniversity opened this issue Mar 26, 2019 · 179 comments

Comments

@GeekUniversity
Copy link
Contributor

GeekUniversity commented Mar 26, 2019

要求

  1. 每周至少完成给定题目中的两道算法题
  2. 围绕每周重点学习的算法知识点,撰写一篇有观点和思考的技术文章(字数不限)

注意事项

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

第一周题目

链表

简单:https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/
简单:https://leetcode-cn.com/problems/merge-two-sorted-lists
中等:https://leetcode-cn.com/problems/swap-nodes-in-pairs/
中等:https://leetcode-cn.com/problems/linked-list-cycle-ii
困难:https://leetcode-cn.com/problems/reverse-nodes-in-k-group/

数组

简单:https://leetcode-cn.com/problems/sort-array-by-parity/
简单:https://leetcode-cn.com/problems/sort-array-by-parity-ii/
中等:https://leetcode-cn.com/problems/search-in-rotated-sorted-array-ii/
中等:https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/
困难:https://leetcode-cn.com/problems/search-in-rotated-sorted-array

简单:https://leetcode-cn.com/problems/valid-parentheses/
中等:https://leetcode-cn.com/problems/next-greater-element-ii/
困难:https://leetcode-cn.com/problems/maximum-frequency-stack/

递归

简单:https://leetcode-cn.com/problems/longest-univalue-path/
中等:https://leetcode-cn.com/problems/partition-to-k-equal-sum-subsets/
困难:https://leetcode-cn.com/problems/special-binary-string/

排序

简单:https://leetcode-cn.com/problems/valid-anagram/
中等:https://leetcode-cn.com/problems/wiggle-sort-ii/
困难:https://leetcode-cn.com/problems/maximum-gap/

二分查找

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

作业提交规则

  1. 在提交作业之前,请先阅读这里的 README 文档:https://github.com/algorithm001/algorithm/blob/master/README.md
  2. 然后在此 Issues 下按照如下格式回复(示例见一楼):
  1. 学号 + GitHub Username
  2. 作业代码的 GitHub 链接(填写自己仓库下对应的作业链接即可,同时记得给本仓库提交 pull request)
  3. 发表自己本周的学习感言 issues,并提交链接,issues 标题格式:“【学号后三位-week1】+文章标题”,格式参考:示例:【000-week1】关于二分查找的一些新的理解 #9
@GeekUniversity
Copy link
Contributor Author

GeekUniversity commented Mar 26, 2019

@Lugyedo
Copy link

Lugyedo commented Apr 10, 2019

怎么知道自己的学号

@Fanlu91
Copy link
Contributor

Fanlu91 commented Apr 15, 2019

第一周题目 (with leetcode.com)

方便使用leetcode.com的同学访问题目地址 :)

链表

简单:https://leetcode.com/problems/remove-duplicates-from-sorted-list/
简单:https://leetcode.com/problems/merge-two-sorted-lists
中等:https://leetcode.com/problems/swap-nodes-in-pairs/
中等:https://leetcode.com/problems/linked-list-cycle-ii
困难:https://leetcode.com/problems/reverse-nodes-in-k-group/

数组

简单:https://leetcode.com/problems/sort-array-by-parity/
简单:https://leetcode.com/problems/sort-array-by-parity-ii/
中等:https://leetcode.com/problems/search-in-rotated-sorted-array-ii/
中等:https://leetcode.com/problems/find-minimum-in-rotated-sorted-array/
困难:https://leetcode.com/problems/search-in-rotated-sorted-array

简单:https://leetcode.com/problems/valid-parentheses/
中等:https://leetcode.com/problems/next-greater-element-ii/
困难:https://leetcode.com/problems/maximum-frequency-stack/

递归

简单:https://leetcode.com/problems/longest-univalue-path/
中等:https://leetcode.com/problems/partition-to-k-equal-sum-subsets/
困难:https://leetcode.com/problems/special-binary-string/

排序

简单:https://leetcode.com/problems/valid-anagram/
中等:https://leetcode.com/problems/wiggle-sort-ii/
困难:https://leetcode.com/problems/maximum-gap/

二分查找

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

@GeekUniversity GeekUniversity pinned this issue Apr 17, 2019
@cwbcheng
Copy link
Contributor

cwbcheng commented Apr 17, 2019

学号:002 Username:cwbcheng
第一周作业链接:https://github.com/cwbcheng/algorithm/tree/master/Week_01/id_2
学习感言:#61

@v1xingyue
Copy link
Contributor

学号:007 Username:v1xingyue
第一周作业链接:https://github.com/v1xingyue/algorithm/tree/master/Week_01/id_7
学习感言:33

@otkinlife
Copy link

otkinlife commented Apr 18, 2019

学号:061 otkinlife(贾凯超)
第一周作业链接:
- 个人仓库: https://github.com/otkinlife/algorithm/tree/master/Week_01/id_61
- 训练营仓库:-
学习感言:#36

@Fanlu91
Copy link
Contributor

Fanlu91 commented Apr 18, 2019

学号:026 Username:Fanlu91
第一周作业链接:https://github.com/Fanlu91/algorithm/tree/master/Week_01/id_26
学习感言:#44

@DevinSu
Copy link
Contributor

DevinSu commented Apr 18, 2019

学号:091 Username:DevinSu(籍东文)
第一周作业链接:https://github.com/Fanlu91/algorithm/tree/master/Week_01/id_91
学习感言:#47

@zjg23
Copy link

zjg23 commented Apr 19, 2019

学号:027 Username:zjg23
第一周作业链接:https://github.com/zjg23/algorithm/tree/master/Week_01/id_27
学习感言: #50

@SherryShi0108
Copy link

学号:086 Username: SherryShi0108
第一周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_01/id_86
学习感言:#51

@lglove
Copy link
Contributor

lglove commented Apr 19, 2019

学号:024 Username: lglove(李戈)
第一周作业链接:https://github.com/lglove/algorithm/blob/master/Week_01/id_24/leet_code.md
学习感言:#54

@suncen0505
Copy link

学号:126 Username:suncen0505
第一周作业链接:https://github.com/suncen0505/algorithm/tree/master/Week_01/id_126
学习感言:#59

@suncen0505
Copy link

学号:002 Username:cwbcheng
第一周作业链接:https://github.com/cwbcheng/algorithm/tree/master/Week_01/id_2
学习感言:-

LeetCode_24_2.cs 两两交换链表中的节点 的题目,感觉还是递归更适合一些,while循环的处理方式中来回赋值好多次,容易乱,不知道你在开发的时候遇到付错值的情况没有,我在写的时候,画图处理,但是发现还是有一个地方没有想清楚。
还有就是我看你的代码应该是在开发工具中写的 , 可以试试在leetcode上,脱离代码提示功能去试试,自己感觉还是提升挺大哈哈

@suncen0505
Copy link

学号:007 Username:v1xingyue
第一周作业链接:https://github.com/v1xingyue/algorithm/tree/master/Week_01/id_7
学习感言:33

go语言的,好像头一次看go语言,哈哈 :=(声明并赋值) 这个都没有看懂,去百度了

@suncen0505
Copy link

学号:061 otkinlife(贾凯超)
第一周作业链接:

还没有做到你的这142题,果断退出,等我自己做一遍后再来回复

@suncen0505
Copy link

学号:024 Username: lglove(李戈)
第一周作业链接:https://github.com/lglove/algorithm/blob/master/Week_01/id_24/leet_code.md
学习感言:#54

83题:
我第一个想到的办法是 创建一个新的ListNode,不断的拿旧的去和新listNode对比,如果有重复的,就不插入,如果没有就插入。

@suncen0505
Copy link

学号:086 Username: SherryShi0108
第一周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_01/id_86
学习感言:#51

多种语言。。。
c# 我的第一想法也是 创建中间变量,然后去赋值 。 if判断中第二个可以加else,这样可以省一次执行
python 最近在学python,但是第一行的注释这句第一反应竟然没有想到是注释,不过重新熟悉了下Python语法,我现在最大的感触就是python的语句末尾不带分号,java需要写分号,在leetcode上写java代码的时候总忘了加分号。

2 similar comments
@suncen0505
Copy link

学号:086 Username: SherryShi0108
第一周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_01/id_86
学习感言:#51

多种语言。。。
c# 我的第一想法也是 创建中间变量,然后去赋值 。 if判断中第二个可以加else,这样可以省一次执行
python 最近在学python,但是第一行的注释这句第一反应竟然没有想到是注释,不过重新熟悉了下Python语法,我现在最大的感触就是python的语句末尾不带分号,java需要写分号,在leetcode上写java代码的时候总忘了加分号。

@suncen0505
Copy link

学号:086 Username: SherryShi0108
第一周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_01/id_86
学习感言:#51

多种语言。。。
c# 我的第一想法也是 创建中间变量,然后去赋值 。 if判断中第二个可以加else,这样可以省一次执行
python 最近在学python,但是第一行的注释这句第一反应竟然没有想到是注释,不过重新熟悉了下Python语法,我现在最大的感触就是python的语句末尾不带分号,java需要写分号,在leetcode上写java代码的时候总忘了加分号。

@suncen0505
Copy link

学号:026 Username:Fanlu91
第一周作业链接:https://github.com/Fanlu91/algorithm/tree/master/Week_01/id_26
学习感言:#44

可以把题目的文件名换成老师给定的格式,这样方便对应题目。还有就是leetcode上直接写代码,他会帮忙验证好多种边界,感觉还挺好的,自己去做验证 ,可能有想不到的边界情况

@zhaozhifu0
Copy link

1、学号:155 Username:zhaozhifu0
2、第一周作业链接:https://github.com/zhaozhifu0/algorithm/tree/master/Week_01/id_155
3、学习感言:#65

@Uriah6140
Copy link

Uriah6140 commented Apr 19, 2019

1、学号:008 Username:WuLei
2、第一周作业链接:https://github.com/Uriah6140/algorithm/tree/master/Week_01/id_8
3、学习感言:--

@ericyang89
Copy link

学号:023 Username:ericyang89
第一周作业链接:20-valid-parentheses
905-sort-array-by-parity
学习感言:#67

@HongChao6
Copy link
Contributor

1、学号:131 Username:HongChao6
2、第一周作业链接:https://github.com/HongChao6/algorithm/tree/master/Week_01/id_131
3、学习感言:#69

@jianghaoyuan2007
Copy link
Contributor

学号:038 Username:jianghaoyuan2007
第一周作业链接:https://github.com/jianghaoyuan2007/algorithm/tree/master/Week_01/id_38
学习感言: #64

@smz198181
Copy link

smz198181 commented Apr 19, 2019

学号:141 Username:smz198181
第一周作业链接:https://github.com/smz198181/algorithm/tree/master/Week_01/id_141
学习感言:#34

@kdbreboot
Copy link
Contributor

学号:003 Username:battlezh
第一周作业链接:https://github.com/battlezh/algorithm/tree/master/Week_01/id_3
学习感言:#79

@salanhess
Copy link
Contributor

学号:040 Username:salanhess
第一周作业链接:https://github.com/salanhess/algorithm/tree/master/Week_01/id_40
学习感言:#81

@shimmer236
Copy link
Contributor

学号:062 Username:shimmer236
第一周作业链接:https://github.com/shimmer236/algorithm/tree/master/Week_01/id_62
学习感言:#62

@defuncc
Copy link

defuncc commented Apr 22, 2019

学号:019 User_name:张进
第一周作业:https://github.com/defuncc/algorithm/tree/master/Week_01/id_19
学习感言:#241

@Zhang-jia-chen
Copy link
Contributor

Zhang-jia-chen commented Apr 22, 2019

学号: 025 User_name:张家琛
第一周作业: https://github.com/Zhang-jia-chen/algorithm/tree/master/Week_01/id_25
学习感言:#290

@wcvolcano
Copy link

学号: 047 User_name:文灿
第一周作业: https://github.com/wcvolcano/algorithm/tree/master/Week_01/id_47
学习感言:#293

@yuqiu-pp
Copy link
Contributor

学号:006 Username:yuqiu-pp
第一周作业链接:https://github.com/yuqiu-pp/algorithm/tree/master/Week_01/id_6
学习感言:#294

@Fanlu91
Copy link
Contributor

Fanlu91 commented Apr 23, 2019

学号:026 Username:Fanlu91
第一周作业链接:https://github.com/Fanlu91/algorithm/tree/master/Week_01/id_26
学习感言:#44

可以把题目的文件名换成老师给定的格式,这样方便对应题目。还有就是leetcode上直接写代码,他会帮忙验证好多种边界,感觉还挺好的,自己去做验证 ,可能有想不到的边界情况

感谢点评。
已经更改了文件名格式。

@liwenbhutao
Copy link

liwenbhutao commented Apr 23, 2019

学号:147 Username:liwenbhutao
第一周作业链接:#218
学习感言:#285

@quanhoucun
Copy link
Contributor

学号:109 Username:quanhoucun
第一周作业链接:https://github.com/quanhoucun/algorithm/tree/master/Week_01/id_109
学习感言:#229

GeekUniversity pushed a commit that referenced this issue Apr 24, 2019
GeekUniversity pushed a commit that referenced this issue Apr 24, 2019
首次合并主项目的提交
GeekUniversity pushed a commit that referenced this issue Apr 24, 2019
GeekUniversity pushed a commit that referenced this issue Apr 24, 2019
GeekUniversity pushed a commit that referenced this issue Apr 24, 2019
GeekUniversity pushed a commit that referenced this issue Apr 24, 2019
@zhaowende
Copy link
Contributor

  1. 学号:123 Username:zhaowende
  2. 第一周作业链接:https://github.com/zhaowende/algorithm/tree/master/Week_01/id_123
  3. 学习感言:【123-week1】学习总结 #298

@Water-DD
Copy link

  1. 学号:011 Username: Water-DD
  2. 第一周作业链接:https://github.com/Water-DD/algorithm/tree/master/Week_01/id_11
    3.学习感言:【011-Week1】学习总结 #128

@zsndev
Copy link
Contributor

zsndev commented Apr 28, 2019

学号:037 Username:tianfeng701
第一周作业链接:https://github.com/tianfeng701/algorithm/tree/master/Week_01/id_37
学习感言: #280

153题思路挺简洁的,求中间值的地方建议可以改成mid = low + ((high - low) >> 1),防止溢出

@zsndev
Copy link
Contributor

zsndev commented Apr 28, 2019

学号:003 Username:battlezh
第一周作业链接:https://github.com/battlezh/algorithm/tree/master/Week_01/id_3
学习感言:#79

测试代码自己撸的啊,感觉可以直接复制leetcode里的,能省不少时间

@zsndev
Copy link
Contributor

zsndev commented Apr 28, 2019

学号:024 Username: lglove(李戈)
第一周作业链接:https://github.com/lglove/algorithm/blob/master/Week_01/id_24/leet_code.md
学习感言:#54

虽然代码提交的方式和老师要求的不一样,但看起来你这个效果更好呀,题目答案在一起,不用分开找了,但在编辑的时候更费事儿吧

@plin005
Copy link
Contributor

plin005 commented Apr 28, 2019

学号:039 Username: plin005
第一周作业链接:
https://github.com/plin005/algorithm/tree/master/Week_01/id_39
学习感言: #248
(由于第一周作业命名不规范, 重新提交第一周作业, 麻烦review, 谢谢~)

@zsndev
Copy link
Contributor

zsndev commented Apr 28, 2019

  1. 学号:014 Username: aiter
  2. 第一周作业链接:https://github.com/aiter/algorithm/tree/master/Week_01/id_14
  3. 学习感言: 【014-week1】学习总结 #94
                int tmp = chars[i] - stack.pop();
                if (tmp != 1 && tmp != 2) {
                    return false;
                }

这段代码服了,要是不看上面的注释,真不知道啥意思,这块儿比较的实现看了好多版本,你的是效率最高的了吧,直接减完事儿

@zsndev
Copy link
Contributor

zsndev commented Apr 28, 2019

1.学号:069 Username:GradyWong
2.第一周作业链接:https://github.com/GradyWong/algorithm/tree/master/Week_01/id_69
3.学习感言:#101

(A[i] & 1) == 0 通过和1 & 等于0 还是1 来判断奇偶,比 直接取余 效率高不少,这个二进制不熟的,写不来

GeekUniversity pushed a commit that referenced this issue Apr 29, 2019
GeekUniversity pushed a commit that referenced this issue May 5, 2019
@wwb4694376
Copy link

学号:132 Username:wwb4694376
第一周作业链接:https://github.com/wwb4694376/algorithm/tree/master/Week_01/id_132
学习感言:#789

@lcfgrn
Copy link

lcfgrn commented May 15, 2019

  1. 学号:014 Username: aiter
  2. 第一周作业链接:https://github.com/aiter/algorithm/tree/master/Week_01/id_14
  3. 学习感言: 【014-week1】学习总结 #94
                int tmp = chars[i] - stack.pop();
                if (tmp != 1 && tmp != 2) {
                    return false;
                }

这段代码服了,要是不看上面的注释,真不知道啥意思,这块儿比较的实现看了好多版本,你的是效率最高的了吧,直接减完事儿

这里需要对acsII比较熟悉,在编码的时候,可以查一下acsii码对照表http://ascii.911cha.com。

@570035853
Copy link

学号:086 Username: SherryShi0108
第一周作业链接:https://github.com/SherryShi0108/algorithm/tree/master/Week_01/id_86
学习感言:#51

哈哈 回头来看大家之前写的总结来了,算法的开始,时间复杂度和空间复杂度

@570035853
Copy link

学号:002 Username:cwbcheng
第一周作业链接:https://github.com/cwbcheng/algorithm/tree/master/Week_01/id_2
学习感言:#61

第一个提交作业的,看你当时状态也是刚刚开始找感觉,希望之后也可以一直坚持学习算法,课程最后一次作业留言,一起加油

@liusuisui
Copy link
Contributor

liusuisui commented May 19, 2019

学号:056 Username:刘姝睿
第一周作业链接:https://github.com/liusuisui/algorithm/new/master/Week_01/id_56
学习感言:#854

@lcfgrn
Copy link

lcfgrn commented May 19, 2019

学号:020 Username:lcfgrn
第二周作业链接:https://github.com/lcfgrn/algorithm/tree/master/Week_01/id_20
学习感言: #871 (comment)

@Uriah6140
Copy link

Uriah6140 commented May 19, 2019

学号:008 Username:Uriah6140
第一周作业链接:https://github.com/Uriah6140/algorithm/tree/id_08_homework/Week_01/id_8

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