File tree Expand file tree Collapse file tree 8 files changed +30
-30
lines changed
Expand file tree Collapse file tree 8 files changed +30
-30
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,6 @@ char[] chars = s.toCharArray();
2020Pattern . matchs() // 字符串匹配
2121```
2222
23-
24-
2523### 动态规划
2624
2725** 第一步骤** :定义** 数组元素的含义** ,我们会用一个数组,来保存历史数组,假设用一维数组 dp[ ] 吧。这个时候有一个非常非常重要的点,就是规定你这个数组元素的含义,例如你的 dp[ i] 是代表什么意思。
Original file line number Diff line number Diff line change 1- ### 二分搜索
1+ ## 二分搜索
22
3- #### 二分搜索模板
3+ ### 二分搜索模板
44
55给一个** 有序数组** 和目标值,找第一次/最后一次/任何一次出现的索引,如果没有出现返回 -1
66
Original file line number Diff line number Diff line change 1- ### 动态规划
1+ # 动态规划
22
3- #### 背景
3+ ## 背景
44
55先从一道题目开始~
66
Original file line number Diff line number Diff line change 1- ### 二叉树
1+ ## 二叉树
22
3- #### 二叉树遍历
3+ ### 二叉树遍历
44
55** 前序遍历** :** 先访问根节点** ,再前序遍历左子树,再前序遍历右子树 ** 中序遍历** :先中序遍历左子树,** 再访问根节点** ,再中序遍历右子树 ** 后序遍历** :先后序遍历左子树,再后序遍历右子树,** 再访问根节点** 。
66
Original file line number Diff line number Diff line change 1- ### 二进制
1+ ## 二进制
22
33JS二进制基础知识: [ 二进制] ( https://wangdoc.com/javascript/operators/bit.html )
44
Original file line number Diff line number Diff line change 1- ### 栈和队列
1+ ## 栈和队列
22
3- #### 简介
3+ ### 简介
44
55栈的特点是后入先出,根据这个特点可以临时保存一些数据,之后用到依次再弹出来,常用于 DFS 深度搜索
66
77队列一般常用于 BFS 广度搜索,类似一层一层的搜索。
88
9- #### Stack 栈
9+ ### Stack 栈
1010
1111##### 155.最小栈 [ min-stack] ( https://leetcode-cn.com/problems/min-stack/ )
1212
Original file line number Diff line number Diff line change 1- ### 链表
1+ ## 链表
22
3- #### 核心点
3+ ### 核心点
44
55- null/nil 异常处理
66- dummy node 哑巴节点
1111- 合并两个链表
1212- 找到链表的中间节点
1313
14- #### 练习
15-
16- ##### 83.删除排序链表中的重复元素 [ remove-duplicates-from-sorted-list] ( https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/ )
17-
18- > 给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。
14+ ** 链表的数据结构**
1915
2016``` js
2117/**
2218 * Definition for singly-linked list.
23- * function ListNode(val) {
24- * this.val = val;
25- * this.next = null;
26- * }
2719 */
20+ function ListNode (val ) {
21+ this .val = val;
22+ this .next = null ;
23+ }
24+ ```
25+
26+ ### 练习
2827
28+ ##### 83.删除排序链表中的重复元素 [ remove-duplicates-from-sorted-list] ( https://leetcode-cn.com/problems/remove-duplicates-from-sorted-list/ )
29+
30+ > 给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。
31+
32+ ``` js
2933var deleteDuplicates = function (head ) {
3034 let current = head;
3135 while (current !== null && current .next !== null ){
@@ -39,10 +43,8 @@ var deleteDuplicates = function(head) {
3943};
4044```
4145
42- 递归写法
43-
4446``` js
45- var deleteDuplicates = function (head ) {
47+ var deleteDuplicates = function (head ) { // 递归写法
4648 if (head === null || head .next === null ){
4749 return head;
4850 }
@@ -69,7 +71,7 @@ var deleteDuplicates = function(head) {
6971 front = front .next ;
7072 back = back .next ;
7173 } else {
72- while (back!== null && front .next .val === back .val ){
74+ while (back !== null && front .next .val === back .val ){
7375 back = back .next ;
7476 }
7577 front .next = back;
Original file line number Diff line number Diff line change 1- ### 递归
1+ ## 递归
22
3- #### 介绍
3+ ### 介绍
44
55将大问题转化为小问题,通过递归依次解决各个小问题。
66
7- #### 示例
7+ ### 示例
88
99##### 334.反转字符串 [ reverse-string] ( https://leetcode-cn.com/problems/reverse-string/ )
1010
You can’t perform that action at this time.
0 commit comments