Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitac17ab9

Browse files
Update
1 parentf2c905d commitac17ab9

14 files changed

+449
-53
lines changed

‎README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@
213213
*[本周小结!(贪心算法系列二)](https://mp.weixin.qq.com/s/RiQri-4rP9abFmq_mlXNiQ)
214214
*[贪心算法:加油站](https://mp.weixin.qq.com/s/aDbiNuEZIhy6YKgQXvKELw)
215215
*[贪心算法:分发糖果](https://mp.weixin.qq.com/s/8MwlgFfvaNYmjGwjuMlETQ)
216+
*[贪心算法:柠檬水找零](https://mp.weixin.qq.com/s/0kT4P-hzY7H6Ae0kjQqnZg)
216217

217218

218219
* 动态规划
@@ -375,6 +376,7 @@
375376
|[0701.二叉搜索树中的插入操作](https://github.com/youngyangyang04/leetcode/blob/master/problems/0701.二叉搜索树中的插入操作.md)|二叉搜索树|简单|**递归****迭代**|
376377
|[0705.设计哈希集合](https://github.com/youngyangyang04/leetcode/blob/master/problems/0705.设计哈希集合.md)|哈希表|简单|**模拟**|
377378
|[0707.设计链表](https://github.com/youngyangyang04/leetcode/blob/master/problems/0707.设计链表.md)|链表|中等|**模拟**|
379+
|[0714.买卖股票的最佳时机含手续费](https://github.com/youngyangyang04/leetcode/blob/master/problems/0714.买卖股票的最佳时机含手续费.md)|贪心 动态规划|中等|**贪心****动态规划** 和122.买卖股票的最佳时机II类似,贪心的思路很巧妙|
378380
|[0763.划分字母区间](https://github.com/youngyangyang04/leetcode/blob/master/problems/0763.划分字母区间.md)|贪心|中等|**双指针/贪心** 体现贪心尽可能多的思想|
379381
|[0738.单调递增的数字](https://github.com/youngyangyang04/leetcode/blob/master/problems/0738.单调递增的数字.md)|贪心算法|中等|**贪心算法** 思路不错,贪心好题|
380382
|[0739.每日温度](https://github.com/youngyangyang04/leetcode/blob/master/problems/0739.每日温度.md)||中等|**单调栈** 适合单调栈入门|
@@ -388,7 +390,7 @@
388390
|[0973.最接近原点的K个点](https://github.com/youngyangyang04/leetcode/blob/master/problems/0973.最接近原点的K个点.md)|优先级队列|中等|**优先级队列**|
389391
|[0977.有序数组的平方](https://github.com/youngyangyang04/leetcode/blob/master/problems/0977.有序数组的平方.md)|数组|中等|**双指针** 还是比较巧妙的|
390392
|[1002.查找常用字符](https://github.com/youngyangyang04/leetcode/blob/master/problems/1002.查找常用字符.md)||简单|****|
391-
|[1005.K次取反后最大化的数组和](https://github.com/youngyangyang04/leetcode/blob/master/problems/1005.K次取反后最大化的数组和.md)|贪心/排序|**贪心算法** 贪心基础题目|
393+
|[1005.K次取反后最大化的数组和](https://github.com/youngyangyang04/leetcode/blob/master/problems/1005.K次取反后最大化的数组和.md)|贪心/排序|简单|**贪心算法** 贪心基础题目|
392394
|[1047.删除字符串中的所有相邻重复项](https://github.com/youngyangyang04/leetcode/blob/master/problems/1047.删除字符串中的所有相邻重复项.md)|哈希表|简单|**哈希表/数组**|
393395
|[1049.最后一块石头的重量II](https://github.com/youngyangyang04/leetcode/blob/master/problems/1049.最后一块石头的重量II.md)|动态规划|中等|**01背包**|
394396
|[1207.独一无二的出现次数](https://github.com/youngyangyang04/leetcode/blob/master/problems/1207.独一无二的出现次数.md)|哈希表|简单|**哈希** 两层哈希|

‎pics/动态规划-背包问题1.png

36.9 KB
Loading

‎pics/动态规划-背包问题2.png

38.8 KB
Loading

‎pics/动态规划-背包问题3.png

37.5 KB
Loading

‎pics/动态规划-背包问题4.png

41.1 KB
Loading

‎problems/0027.移除元素.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
>笔者在BAT从事技术研发多年,利用工作之余重刷leetcode,更多原创文章请关注公众号「代码随想录」。
2-
3-
#题目地址
4-
5-
https://leetcode-cn.com/problems/remove-element/
1+
<palign='center'>
2+
<imgsrc="https://img-blog.csdnimg.cn/20201215214102642.png"width=400 >
3+
</p>
4+
<palign="center">
5+
<ahref="https://github.com/youngyangyang04/leetcode-master"><imgsrc="https://img.shields.io/badge/Github-leetcode--master-lightgrey"alt=""></a>
6+
<ahref="https://img-blog.csdnimg.cn/20201115103410182.png"><imgsrc="https://img.shields.io/badge/刷题-微信群-green"alt=""></a>
7+
<ahref="https://img-blog.csdnimg.cn/20201210231711160.png"><imgsrc="https://img.shields.io/badge/公众号-代码随想录-brightgreen"alt=""></a>
8+
<ahref="https://space.bilibili.com/525438321"><imgsrc="https://img.shields.io/badge/B站-代码随想录-orange"alt=""></a>
9+
<ahref="https://www.zhihu.com/people/sun-xiu-yang-64"><imgsrc="https://img.shields.io/badge/知乎-代码随想录-blue"alt=""></a>
10+
<ahref="https://www.toutiao.com/c/user/60356270818/#mid=1633692776932365"><imgsrc="https://img.shields.io/badge/头条-代码随想录-red"alt=""></a>
11+
</p>
612

713
>移除元素想要高效的话,不是很简单!
814
915
#编号:27. 移除元素
1016

17+
题目地址:https://leetcode-cn.com/problems/remove-element/
18+
1119
给你一个数组 nums 和一个值 val,你需要 原地 移除所有数值等于 val 的元素,并返回移除后数组的新长度。
1220

1321
不要使用额外的数组空间,你必须仅使用 O(1) 额外空间并**原地**修改输入数组。
@@ -112,7 +120,8 @@ public:
112120
};
113121
```
114122

115-
拓展: 也可以一个指向前面,一个指向后面,遇到需要删除的就交换,最后返回指针的位置加1,只不过这么做更改了数组元素的位置了,不算是移除元素。
116-
117-
>更多算法干货文章持续更新,可以微信搜索「代码随想录」第一时间围观,关注后,回复「Java」「C++」 「python」「简历模板」「数据结构与算法」等等,就可以获得我多年整理的学习资料。
123+
**循序渐进学算法,认准「代码随想录」,Carl手把手带你过关斩将!**
118124

125+
<palign='center'>
126+
<imgsrc="https://img-blog.csdnimg.cn/20201216002707465.jpg"width=200 >
127+
</p>

‎problems/0035.搜索插入位置.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444

4545
这道题目,要在数组中插入目标值,无非是这四种情况。
4646

47-
<imgsrc='../pics/35_搜索插入位置3.png'width=600> </img></div>
47+
![35_搜索插入位置3](https://img-blog.csdnimg.cn/20201216232148471.png)
4848

4949
* 目标值在数组所有元素之前
5050
* 目标值等于数组中某一个元素
@@ -85,13 +85,13 @@ public:
8585

8686
效率如下:
8787

88-
<imgsrc='../pics/35_搜索插入位置.png'width=600> </img></div>
88+
![35_搜索插入位置](https://img-blog.csdnimg.cn/20201216232127268.png)
8989

9090
##二分法
9191

9292
既然暴力解法的时间复杂度是O(n),就要尝试一下使用二分查找法。
9393

94-
<imgsrc='../pics/35_搜索插入位置4.png'width=600> </img></div>
94+
![35_搜索插入位置4](https://img-blog.csdnimg.cn/202012162326354.png)
9595

9696
大家注意这道题目的前提是数组是有序数组,这也是使用二分查找的基础条件。
9797

@@ -101,7 +101,7 @@ public:
101101

102102
大体讲解一下二分法的思路,这里来举一个例子,例如在这个数组中,使用二分法寻找元素为5的位置,并返回其下标。
103103

104-
<imgsrc='../pics/35_搜索插入位置5.png'width=600> </img></div>
104+
![35_搜索插入位置5](https://img-blog.csdnimg.cn/20201216232659199.png)
105105

106106
二分查找涉及的很多的边界条件,逻辑比较简单,就是写不好。
107107

@@ -151,7 +151,7 @@ public:
151151
时间复杂度:O(1)
152152

153153
效率如下:
154-
<imgsrc='../pics/35_搜索插入位置2.png'width=600> </img></div>
154+
![35_搜索插入位置2](https://img-blog.csdnimg.cn/2020121623272877.png)
155155

156156
##二分法第二种写法
157157

‎problems/0059.螺旋矩阵II.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
1-
>笔者在BAT从事技术研发多年,利用工作之余重刷leetcode,更多原创文章请关注公众号「代码随想录」。
21

3-
#题目地址
4-
https://leetcode-cn.com/problems/spiral-matrix-ii/
2+
<palign='center'>
3+
<imgsrc="https://img-blog.csdnimg.cn/20201215214102642.png"width=400 >
4+
</p>
5+
<palign="center">
6+
<ahref="https://github.com/youngyangyang04/leetcode-master"><imgsrc="https://img.shields.io/badge/Github-leetcode--master-lightgrey"alt=""></a>
7+
<ahref="https://img-blog.csdnimg.cn/20201115103410182.png"><imgsrc="https://img.shields.io/badge/刷题-微信群-green"alt=""></a>
8+
<ahref="https://img-blog.csdnimg.cn/20201210231711160.png"><imgsrc="https://img.shields.io/badge/公众号-代码随想录-brightgreen"alt=""></a>
9+
<ahref="https://space.bilibili.com/525438321"><imgsrc="https://img.shields.io/badge/B站-代码随想录-orange"alt=""></a>
10+
<ahref="https://www.zhihu.com/people/sun-xiu-yang-64"><imgsrc="https://img.shields.io/badge/知乎-代码随想录-blue"alt=""></a>
11+
<ahref="https://www.toutiao.com/c/user/60356270818/#mid=1633692776932365"><imgsrc="https://img.shields.io/badge/头条-代码随想录-red"alt=""></a>
12+
</p>
13+
514

615
>一进循环深似海,从此offer是路人
716
817
#题目59.螺旋矩阵II
918

19+
题目地址:https://leetcode-cn.com/problems/spiral-matrix-ii/
1020
给定一个正整数 n,生成一个包含 1 到 n2 所有元素,且元素按顺时针顺序螺旋排列的正方形矩阵。
1121

1222
示例:
@@ -48,7 +58,7 @@ https://leetcode-cn.com/problems/spiral-matrix-ii/
4858

4959
那么我按照左闭右开的原则,来画一圈,大家看一下:
5060

51-
<imgsrc='../pics/螺旋矩阵.png'width=600> </img></div>
61+
![螺旋矩阵](https://img-blog.csdnimg.cn/2020121623550681.png)
5262

5363
这里每一种颜色,代表一条边,我们遍历的长度,可以看出每一个拐角处的处理规则,拐角处让给新的一条边来继续画。
5464

@@ -111,5 +121,9 @@ public:
111121
}
112122
};
113123
```
114-
>更过算法干货文章持续更新,可以微信搜索「代码随想录」第一时间围观,关注后,回复「Java」「C++」 「python」「简历模板」「数据结构与算法」等等,就可以获得我多年整理的学习资料。
115124

125+
**循序渐进学算法,认准「代码随想录」,Carl手把手带你过关斩将!**
126+
127+
<palign='center'>
128+
<imgsrc="https://img-blog.csdnimg.cn/20201216002707465.jpg"width=200 >
129+
</p>

‎problems/0106.从中序与后序遍历序列构造二叉树.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
##题目地址
22
https://leetcode-cn.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal/
33

4-
>给出两个序列
4+
>给出两个序列 (可以加unorder_map优化一下)
55
66
看完本文,可以一起解决如下两道题目
77

‎problems/0209.长度最小的子数组.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
1-
##题目地址
2-
https://leetcode-cn.com/problems/minimum-size-subarray-sum/
1+
<palign='center'>
2+
<imgsrc="https://img-blog.csdnimg.cn/20201215214102642.png"width=400 >
3+
</p>
4+
<palign="center">
5+
<ahref="https://github.com/youngyangyang04/leetcode-master"><imgsrc="https://img.shields.io/badge/Github-leetcode--master-lightgrey"alt=""></a>
6+
<ahref="https://img-blog.csdnimg.cn/20201115103410182.png"><imgsrc="https://img.shields.io/badge/刷题-微信群-green"alt=""></a>
7+
<ahref="https://img-blog.csdnimg.cn/20201210231711160.png"><imgsrc="https://img.shields.io/badge/公众号-代码随想录-brightgreen"alt=""></a>
8+
<ahref="https://space.bilibili.com/525438321"><imgsrc="https://img.shields.io/badge/B站-代码随想录-orange"alt=""></a>
9+
<ahref="https://www.zhihu.com/people/sun-xiu-yang-64"><imgsrc="https://img.shields.io/badge/知乎-代码随想录-blue"alt=""></a>
10+
<ahref="https://www.toutiao.com/c/user/60356270818/#mid=1633692776932365"><imgsrc="https://img.shields.io/badge/头条-代码随想录-red"alt=""></a>
11+
</p>
312

413
>滑动窗口拯救了你
514
615
#题目209.长度最小的子数组
716

17+
题目链接:https://leetcode-cn.com/problems/minimum-size-subarray-sum/
18+
819
给定一个含有 n 个正整数的数组和一个正整数 s ,找出该数组中满足其和 ≥ s 的长度最小的 连续 子数组,并返回其长度。如果不存在符合条件的子数组,返回 0。
920

1021
示例:
@@ -107,5 +118,9 @@ public:
107118
时间复杂度:O(n)
108119
空间复杂度:O(1)
109120

110-
>更多算法干货文章持续更新,可以微信搜索「代码随想录」第一时间围观,关注后,回复「Java」「C++」 「python」「简历模板」「数据结构与算法」等等,就可以获得我多年整理的学习资料。
111121

122+
**循序渐进学算法,认准「代码随想录」,Carl手把手带你过关斩将!**
123+
124+
<palign='center'>
125+
<imgsrc="https://img-blog.csdnimg.cn/20201216002707465.jpg"width=200 >
126+
</p>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp