algorithm001 / algorithm

119 stars 152 forks source link

算法训练营第四周作业 #509

Open GeekUniversity opened 5 years ago

GeekUniversity commented 5 years ago

本周重点学习知识点

Trie树、AC自动机、贪心算法、分治算法、回溯算法、动态规划

要求

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

注意事项

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

第四周题目

Trie树

简单:https://leetcode-cn.com/problems/longest-word-in-dictionary/ 中等:https://leetcode-cn.com/problems/add-and-search-word-data-structure-design/ 困难:https://leetcode-cn.com/problems/word-search-ii/

分治算法

简单:https://leetcode-cn.com/problems/majority-element/ 中等:https://leetcode-cn.com/problems/different-ways-to-add-parentheses/ 困难:https://leetcode-cn.com/problems/burst-balloons/

贪心算法

简单:https://leetcode-cn.com/problems/assign-cookies/ 中等:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/ 困难:https://leetcode-cn.com/problems/ipo/

回溯算法

简单:https://leetcode-cn.com/problems/letter-case-permutation/ 中等:https://leetcode-cn.com/problems/add-and-search-word-data-structure-design/ 困难:https://leetcode-cn.com/problems/n-queens/

动态规划

简单:https://leetcode-cn.com/problems/min-cost-climbing-stairs/ 中等:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/ 困难:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iv/ 困难:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-iii/ 困难:https://leetcode-cn.com/problems/edit-distance/

作业提交规则

  1. 在提交作业之前,请先阅读这里的 README 文档:https://github.com/algorithm001/algorithm/blob/master/README.md
  2. 然后在此 Issues 下按照如下格式回复:
  1. 学号 + GitHub Username
  2. 作业代码的 GitHub 链接(填写自己仓库下对应的作业链接即可,同时记得给本仓库提交 pull request)
  3. 发表自己本周的学习感言 issues,并提交链接,issues 标题格式:“【学号后三位-week4】+文章标题”,格式参考:https://github.com/algorithm001/algorithm/issues/9
lovingcodesk commented 5 years ago

学号:121 Username:lovingcodesk 第四周作业链接:https://github.com/algorithm001/algorithm/pull/636 学习感言:

AndroidQin commented 5 years ago

学号:095 Username:AndroidQin 第四周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_04/id_95 学习感言:#642

Fanlu91 commented 5 years ago

第四周题目

Trie树

简单:https://leetcode.com/problems/longest-word-in-dictionary/ 中等:https://leetcode.com/problems/add-and-search-word-data-structure-design/ 困难:https://leetcode.com/problems/word-search-ii/

分治算法

简单:https://leetcode.com/problems/majority-element/ 中等:https://leetcode.com/problems/different-ways-to-add-parentheses/ 困难:https://leetcode.com/problems/burst-balloons/

贪心算法

简单:https://leetcode.com/problems/assign-cookies/ 中等:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee/ 困难:https://leetcode.com/problems/ipo/

回溯算法

简单:https://leetcode.com/problems/letter-case-permutation/ 中等:https://leetcode.com/problems/add-and-search-word-data-structure-design/ 困难:https://leetcode.com/problems/n-queens/

动态规划

简单:https://leetcode.com/problems/min-cost-climbing-stairs/ 中等:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-with-cooldown/ 困难:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iv/ 困难:https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii/ 困难:https://leetcode.com/problems/edit-distance/

aiter commented 5 years ago

学号:095 Username:AndroidQin 第四周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_04/id_95 学习感言:#642

作业提交积极,赞。代码清晰易读

tidelgl commented 5 years ago

学号:064 Username:李路 第四周作业链接:https://github.com/tidelgl/algorithm/tree/week-4/Week_04/id_64 学习感言:https://github.com/algorithm001/algorithm/issues/646

zjg23 commented 5 years ago

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

suncen0505 commented 5 years ago

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

suncen0505 commented 5 years ago

学号:095 Username:AndroidQin 第四周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_04/id_95 学习感言:#642

我也是做了两道简单的题,还是依据老师的套路,用了笨法,再去化简的,感觉老师的套路泰通用了

suncen0505 commented 5 years ago

学号:064 Username:李路 第四周作业链接:https://github.com/tidelgl/algorithm/tree/week-4/Week_04/id_64 学习感言:#646

你做了好多题呀,我也喜欢在本上记笔记,不过最近发现本上记录好像找一个知识点有点费劲,哈哈 ,最近在考虑用在线笔记做记录呢

AndroidQin commented 5 years ago

学号:095 Username:AndroidQin 第四周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_04/id_95 学习感言:#642

我也是做了两道简单的题,还是依据老师的套路,用了笨法,再去化简的,感觉老师的套路泰通用了

一起加油吧,我这得抓紧跟啊

suncen0505 commented 5 years ago

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

我好像还没用过前序遍历、中序遍历和后序遍历,一直在用同一种递归,有时间去优化下代码

SherryShi0108 commented 5 years ago

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

suncen0505 commented 5 years ago

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

活动结束,但是咱们的学习没有结束,以后学完咱们好好交流

suncen0505 commented 5 years ago

学号:095 Username:AndroidQin 第四周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_04/id_95 学习感言:#642

我也得再重新看一遍,到时候学完咱们再总结,一起交流

ericyang89 commented 5 years ago

学号:023 Username: ericyang89 第四周作业链接:https://github.com/ericyang89/algorithm/tree/master/Week_04/id_23 学习感言:#650 编程语言:JavaScript

HongChao6 commented 5 years ago

学号:131 Username: HongChao6 第四周作业链接:https://github.com/HongChao6/algorithm/tree/master/Week_04/id_131 学习感言:#651 编程语言:C++

HongChao6 commented 5 years ago

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

活动结束,但是咱们的学习没有结束,以后学完咱们好好交流

以后咱们就在这个github上建分支呗,然后有问题在 issue 上提交,每次的leetcode题也可提交

HongChao6 commented 5 years ago

学号:095 Username:AndroidQin 第四周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_04/id_95 学习感言:#642

嗯,一起努力吧

HongChao6 commented 5 years ago

学号:121 Username:lovingcodesk 第四周作业链接:#636 学习感言:

我跟你实现的方法一样,不过我是用C++,看你 JAVA 代码正好熟悉一下不同语言

HongChao6 commented 5 years ago

学号:095 Username:AndroidQin 第四周作业链接:https://github.com/AndroidQin/algorithm/tree/master/Week_04/id_95 学习感言:#642

感觉784可以 先将字母处理成数字,然后用 hash 实现

HongChao6 commented 5 years ago

学号:023 Username: ericyang89 第四周作业链接:https://github.com/ericyang89/algorithm/tree/master/Week_04/id_23 学习感言:#650 编程语言:JavaScript

动态规划一般可以用填表来实现,还是做题少,不大熟练

FollowMyHeart commented 5 years ago
  1. 学号:033 Username:FollowMyHeart 2.第四周作业链接: https://github.com/FollowMyHeart/algorithm/tree/master/Week_04/id_33
  2. 学习感言:#653
FollowMyHeart commented 5 years ago

学号:064 Username:李路 第四周作业链接:https://github.com/tidelgl/algorithm/tree/week-4/Week_04/id_64 学习感言:#646

你做了好多题呀,我也喜欢在本上记笔记,不过最近发现本上记录好像找一个知识点有点费劲,哈哈 ,最近在考虑用在线笔记做记录呢

嗯,记在在线笔记上能够笔记好的查阅以前的记录!

salanhess commented 5 years ago

学号:040 Username: salanhess 第四周作业链接:https://github.com/salanhess/algorithm/tree/master/Week_04/id_40 学习感言:https://github.com/algorithm001/algorithm/issues/655 编程语言:golang

otkinlife commented 5 years ago

学号:061 Username:otkinlife@163.com(贾凯超) 第四周作业链接:https://github.com/otkinlife/algorithm/tree/master/Week_04/id_61 学习感言:#656

aiter commented 5 years ago

学号:014 Username:aiter 第四周作业链接 java:https://github.com/aiter/algorithm/tree/master/Week_04/id_14 学习感言: #657

aiter commented 5 years ago

学号:061 Username:otkinlife@163.com(贾凯超) 第四周作业链接:https://github.com/otkinlife/algorithm/tree/master/Week_04/id_61 学习感言:#656

764 写得真好,这题我花了不少时间

AHaoPang commented 5 years ago

学号:009 用户名:AHaoPang 第三周作业链接:https://github.com/AHaoPang/algorithm/tree/master/Week_04/id_9 学习感言:#658

yxs354 commented 5 years ago

学号:044 Username: yxs354 第四周作业链接:https://github.com/yxs354/algorithm/tree/master/Week_04/id_44 学习感言:#662

hijkoo commented 5 years ago

学号:012 Username: hijkoo 第四周作业链接:https://github.com/hijkoo/algorithm/tree/master/Week_04/id_12 学习感言:#663

otkinlife commented 5 years ago

学号:044 Username: yxs354 第四周作业链接:https://github.com/yxs354/algorithm/tree/master/Week_04/id_44 学习感言:#662

169 我一直没想到怎么用分治法解,学到了

otkinlife commented 5 years ago

学号:009 用户名:AHaoPang 第三周作业链接:https://github.com/AHaoPang/algorithm/tree/master/Week_04/id_9 学习感言:#658

这两道题都还没有做过。先学习一下

otkinlife commented 5 years ago

学号:023 Username: ericyang89 第四周作业链接:https://github.com/ericyang89/algorithm/tree/master/Week_04/id_23 学习感言:#650 编程语言:JavaScript

填表法确实好用。非常直观而且可以提高效率

otkinlife commented 5 years ago

学号:012 Username: hijkoo 第四周作业链接:https://github.com/hijkoo/algorithm/tree/master/Week_04/id_12 学习感言:#663

我也是做PHP的,其实一直挺纠结的。用PHP解题如果不用库函数效率会很低,如果用库函数就达不到算法训练的目的了

otkinlife commented 5 years ago

学号:040 Username: salanhess 第四周作业链接:https://github.com/salanhess/algorithm/tree/master/Week_04/id_40 学习感言:#655 编程语言:golang

169我的思路也是先排序然后找中位数。后来看到其他同学有用分治思想解决。感觉可以借鉴一下

brokge commented 5 years ago

学号:080 Username:brokge 第四周作业链接:https://github.com/brokge/algorithm/tree/master/Week_04/id_80 学习感言:#665 编程语言:Java

jianghaoyuan2007 commented 5 years ago

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

quanhoucun commented 5 years ago

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

361028096 commented 5 years ago

学号:053 Username:361028096 第四周作业链接:https://github.com/361028096/algorithm/tree/master/Week_04/id_53 学习感言: #668 编程语言:java

wangxu0 commented 5 years ago

学号:134 Username:wxisme 第四周作业链接:https://github.com/wxisme/algorithm/tree/master/Week_04/id_134 学习总结:https://github.com/algorithm001/algorithm/issues/671

wangxu0 commented 5 years ago

学号:040 Username: salanhess 第四周作业链接:https://github.com/salanhess/algorithm/tree/master/Week_04/id_40 学习感言:#655 编程语言:golang

169我的思路也是先排序然后找中位数。后来看到其他同学有用分治思想解决。感觉可以借鉴一下

Lugyedo commented 5 years ago

学号:036 UserName:Lugyedo 第四周作业连接:https://github.com/Lugyedo/algorithm/tree/master/Week_04/id_36 学习总结:https://github.com/algorithm001/algorithm/issues/673

Lugyedo commented 5 years ago

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

学算法最好不要调用系统函数Sort

bugcodes commented 5 years ago

学号:049 Username:bugcodes 第四周作业链接:https://github.com/bugcodes/algorithm/tree/master/Week_04/id_49 学习感言: #675

sadcat commented 5 years ago

学号:113 Username:sadcat 第四周作业链接(ruby):https://github.com/algorithm001/algorithm/pull/676 学习感言: https://github.com/algorithm001/algorithm/issues/677

isnotnull commented 5 years ago
  1. 学号:074 Username:isnotnull
  2. 第四周作业链接:https://github.com/isnotnull/algorithm/tree/master/Week_04/id_74
  3. 学习感言: #679
plin005 commented 5 years ago

学号: 039, GitHub Username: plin005 第四周作业链接:https://github.com/plin005/algorithm/tree/master/Week_04/id_39 学习感言: 【039-week4】学习总结”,#681

v1xingyue commented 5 years ago

学号: 007 GitHub Username : @v1xingyue 第四周作业链接: https://github.com/v1xingyue/algorithm/tree/master/Week_04/id_7 学习总结: #684

hapiman commented 5 years ago

学号: 117 GitHub Username : hapiman(彭建) 第四周作业链接: https://github.com/hapiman/algorithm/tree/master/Week_04/id_117 学习总结: https://github.com/algorithm001/algorithm/issues/685
编程语言:Go

Hermancg commented 5 years ago

学号: 088 GitHub Username : Hermancg 第四周作业链接: https://github.com/Hermancg/algorithm/tree/master/Week_04/id_88 学习总结: #686