├── .gitignore ├── .prettierrc.js ├── 1.算法框架_labuladong ├── 1.必备算法框架 │ ├── 0.最长公共子序列 DP.js │ ├── 0_学习刷题的框架思维.js │ ├── 10_双指针技巧总结.js │ ├── 11_滑动窗口.js │ ├── 12_贪心算法-区间调度问题.js │ ├── 12_贪心算法.js │ ├── 13_前缀和 Ksum套路.js │ ├── 14.LRU缓存淘汰算法.js │ ├── 15.LFU使用次数最少缓存淘汰算法.js │ ├── 1_动态规划_框架.js │ ├── 2_DFS_框架.ts │ ├── 3_BFS_框架.js │ ├── 3_DFS与BFS使用范围.js │ ├── 4_分治框架_归并排序.js │ ├── 4_分治算法_框架.js │ ├── 5_回溯算法_团灭子集-排列-组合问题.js │ ├── 5_递归框架.js │ ├── 6.二分法.java │ ├── 6_二分搜索_左右指针.js │ ├── 6_二分法实战_887.高楼扔鸡蛋.js │ ├── 6_如何运用二分查找算法.js │ ├── 6_新_二分搜索的框架运用.ts │ ├── 7_二叉树常见操作.js │ ├── 7_二叉树遍历 框架.js │ ├── 8_单调栈.js │ ├── 8_单调队列.js │ ├── 9_差分数组.js │ ├── javascript常见位操作.js │ ├── java版本 │ │ └── nSum问题.java │ ├── 两个栈实现队列.js │ ├── 优先级队列.js │ ├── 团灭nSum问题.js │ ├── 团灭区间问题.js │ ├── 团灭打家劫舍问题.js │ ├── 团灭股票买卖问题.js │ ├── 如何计算编辑距离.js │ ├── 子集背包问题.js │ ├── 完全背包问题.js │ ├── 洗牌算法_打乱数组.js │ ├── 补充_208. 实现 Trie (前缀树).js │ ├── 队列实现栈.ts │ ├── 集合_Set结构直接实现.js │ └── 高效进行模幂运算.js ├── 10.回文系列 │ ├── 235.回文链表 copy.js │ ├── 最长回文子序列-模板.js │ ├── 构造回文的最小插入次数.js │ └── 5.最长回文字符串.js ├── 11.分治算法框架 │ └── 分治算法.js ├── 12.贪心算法 │ ├── 45. 跳跃游戏 II.js │ ├── 55. 跳跃游戏.js │ └── 贪心算法框架.js ├── 13.滑动窗口_解决子串子数组问题 │ ├── 3. 无重复字符的最长子串.js │ ├── 438. 找到字符串中所有字母异位词.js │ ├── 567.字符串排列.js │ ├── 76. 最小覆盖子串.js │ └── 992. Subarrays with K Different Integers.java ├── 14.区间问题 │ ├── 435.无重叠区间.js │ ├── 区间交集.js │ ├── 区间合并.js │ └── 团灭区间问题.js ├── 15.差分算法_前缀和算法 │ └── 1109.航班预统计.js ├── 16.图 │ ├── Dijkstra最短路径算法 │ │ ├── 1514. 概率最大的路径.ts │ │ ├── 1631. 最小体力消耗路径.ts │ │ ├── 743. 网络延迟时间.ts │ │ ├── dijkstra.ts │ │ ├── heap.ts │ │ └── index.md │ ├── Kruskal最小生成树算法 │ │ └── Kruskal算法 │ │ │ ├── 1135. 最低成本联通所有城市.ts │ │ │ ├── 1584. 连接所有点的最小费用-优先级队列.ts │ │ │ ├── 1584. 连接所有点的最小费用.ts │ │ │ ├── 1584.go │ │ │ ├── 261. 以图判树.ts │ │ │ ├── index.assets │ │ │ ├── image-20211110190005995.png │ │ │ └── image-20211110190557406.png │ │ │ ├── index.md │ │ │ └── tempCodeRunnerFile.ts │ ├── Prim算法 │ │ ├── Prim.ts │ │ ├── index.md │ │ └── index.ts │ ├── 二分图 │ │ ├── 277.搜索名人.ts │ │ ├── 785. 判断二分图.ts │ │ ├── 886. 可能的二分法.ts │ │ ├── index.assets │ │ │ ├── image-20211109195657727.png │ │ │ └── image-20211109195758476.png │ │ └── index.md │ ├── 图-并查集Union Find算法 │ │ ├── index.assets │ │ │ ├── image-20211109205259544.png │ │ │ ├── image-20211109205329402.png │ │ │ ├── image-20211109205448827.png │ │ │ ├── image-20211109205958477.png │ │ │ ├── image-20211109210254277.png │ │ │ └── image-20211109212508193.png │ │ ├── index.md │ │ └── index.ts │ ├── 图遍历算法 │ │ └── graph.ts │ ├── 拓扑排序 环检测 │ │ ├── 207.课程表.py │ │ ├── 207.课程表.ts │ │ ├── 210.课程表 II.ts │ │ ├── index.assets │ │ │ ├── image-20211108200919765.png │ │ │ ├── image-20211108201515013.png │ │ │ └── image-20211108201526738.png │ │ └── index.md │ └── 自己补充 │ │ └── 0-1Matrix.java ├── 17.位运算 │ ├── 448.找到所有数组中消失的数字.js │ └── js常见位操作.js ├── 18.未分类题目 │ ├── 172阶乘后的零.js │ ├── 283.移动0.js │ ├── 292.Nim游戏.js │ ├── 319灯泡开关.js │ ├── 380. 常数时间插入、删除和获取随机元素.js │ ├── 384. 打乱数组.js │ ├── 43. 字符串相乘.js │ ├── 773.滑动谜题_未解决.js │ ├── 83.删除排序链表中的重复元素.js │ ├── 877石头游戏.js │ └── test.js ├── 19.高频面试题 │ ├── 0.快速求幂.js │ ├── 1024.视频剪辑.js │ ├── 20.有效的括号.js │ ├── 234.回文链表.js │ ├── 241. Different Ways to Add Parentheses.java │ ├── 372.超级次方.js │ ├── 652.寻找重复的子树.js │ ├── 793.阶乘后K个零.js │ ├── 845. 数组中的最长山脉.js │ ├── 855.考生座位 Exam Room.js │ ├── K个一组翻转链表.js │ ├── test.js │ ├── 二分查找高效判定子序列 copy.js │ ├── 常见的阶乘算法题.js │ ├── 计算器_完全版.js │ ├── 计算器完全版.java │ └── 高效寻找素数.js ├── 2.排序算法 合集 │ ├── 1.冒泡排序.js │ ├── 10.计数排序.js │ ├── 2.选择排序.js │ ├── 3.插入排序.js │ ├── 4.快速排序_就是二叉树的前序遍历.js │ ├── 5.归并排序_就是二叉树的后序遍历.js │ ├── 6.希尔shell排序.js │ ├── 7.堆排序.js │ ├── 8.桶排序.js │ ├── 9.基数排序.js │ ├── Java归并排序.java │ ├── Java快速排序.java │ └── 排序算法分类.js ├── 3.二叉搜索树 │ ├── index.md │ ├── 第一期 │ │ ├── 230寻找第 K 小的元素.java │ │ ├── 230寻找第 K 小的元素.ts │ │ ├── 530二叉搜索树转为累加树.java │ │ └── TreeNode.java │ ├── 第三期 │ │ ├── 95. Unique Binary Search Trees II.go │ │ ├── 95. Unique Binary Search Trees II.ts │ │ ├── 95.不同的二叉树II.java │ │ ├── 96. Unique Binary Search Trees.go │ │ ├── 96. Unique Binary Search Trees.ts │ │ └── 96. 不同的二叉搜索树.java │ └── 第二期 │ │ ├── 在 BST 中删除一个数.java │ │ ├── 在 BST 中插入一个数.java │ │ ├── 在 BST 中搜索一个数.java │ │ └── 检测BST.java ├── 3.二叉树集锦 │ ├── 104.二叉树最大深度.java │ ├── 105.通过前序和中序遍历结果构造二叉树.java │ ├── 105.通过前序和中序遍历结果构造二叉树.js │ ├── 106通过后序和中序遍历结果构造二叉树.js │ ├── 116. 填充每个节点的下一个右侧节点指针.java │ ├── 124求二叉树中的最大路径和.js │ ├── 1373.二叉搜索子树的最大键值和.go │ ├── 1373.二叉搜索子树的最大键值和.ts │ ├── 653.查找重复子树返回根节点.java │ ├── 654.构造最大二叉树.js │ ├── 99.恢复一颗BST.js │ ├── TreeNode.java │ ├── index.md │ ├── 二叉堆详解实现优先级队列.js │ ├── 二叉树序列化.js │ ├── 二叉树详解部分.md │ └── 二叉树遍历 框架.js ├── 3.前缀树模板 │ ├── 208.实现Trie前缀树.java │ ├── 648.单词替换-简洁版.java │ ├── 648.单词替换.java │ ├── TrieMap-Simple.java │ ├── index.md │ └── trieMap.java ├── 4.单调栈__单调队列 │ └── 316. 去除重复字母-字典序.js ├── 5.动态规划问题 合集 │ ├── 0. 0-1背包问题.js │ ├── 00_动态规划解题套路.js │ ├── 452. 戳爆气球.js │ ├── 494.目标和.js │ ├── 72.编辑距离_动态规划.js │ ├── 887.高楼扔鸡蛋.js │ ├── dp详解_最优子结构详解.js │ ├── 博弈问题.js │ ├── 原地修改数组算法.js │ ├── 团灭LeetCode股票买卖问题.js │ ├── 团灭打家劫舍问题.js │ ├── 团灭背包问题.java │ ├── 子序列解题模板.js │ ├── 子集背包问题.js │ ├── 完全背包问题.js │ ├── 最大子数组.js │ ├── 最长回文子序列-模板.js │ ├── 最长递增子序列.js │ ├── 构造回文的最小插入次数.js │ ├── 正则通配符算法.js │ ├── 状态压缩 dp降维.js │ └── 5.最长回文字符串.js ├── 6.双指针_快慢指针 │ ├── 26. 删除排序数组中的重复项.js │ ├── 27.移动元素.js │ ├── 42.接雨水问题.js │ ├── 双指针技巧 大全.js │ └── 团灭nSum问题.js ├── 7.回溯算法问题合集 │ ├── 46.全排列问题.js │ ├── 698.Parition to K Equal Sum subsets.java │ ├── 969.煎饼排序_递归.js │ ├── N皇后.js │ ├── 回溯_DFS_算法套路.js │ ├── 括号生成.js │ ├── 解数独问题.js │ └── 重点_团灭子集-排列-组合问题.js ├── 8.递归汇总 │ ├── 24.反转链表.js │ └── 团灭反转链表.js ├── 9.二分法_详解 │ ├── 1011. 在 D 天内送达包裹的能力.js │ ├── 410.分割数组的最大值.js │ ├── 875. 爱吃香蕉的珂珂.js │ ├── 887.高楼扔鸡蛋_二分法.js │ ├── twoSum问题.js │ ├── 二分搜索_就是左右指针.js │ └── 二分查找高效判定子序列.js └── New Topics_after 2021-08 │ ├── .gitkeep │ ├── DFS 岛屿问题 │ ├── 1020.飞地的数量.ts │ ├── 1254.统计封闭岛屿的数目.ts │ ├── 1905.统计子岛屿.ts │ ├── 200.岛屿数量.ts │ ├── 694.不同的岛屿数量.ts │ ├── 695.岛屿的最大面积.ts │ ├── index.md │ └── test.ts │ ├── Python技巧.md │ ├── index.md │ ├── test.ts │ ├── 二叉树八股文:递归改迭代通用模板 │ ├── index.md │ └── 迭代遍历二叉树.ts │ ├── 动态规划 │ ├── 174.地下城游戏.go │ └── 174.地下城游戏.ts │ ├── 回溯算法 │ ├── 698.划分为k个相等的子集.go │ ├── 698.划分为k个相等的子集.tsx │ └── index.md │ ├── 待完成 │ ├── 139. 单词拆分.py │ ├── 1644 二叉树的最近公共祖先2.py │ ├── 1650. 二叉树的最近公共祖先 III.py │ ├── 1676. 二叉树的最近公共祖先 IV.py │ ├── 35. Search Insert Position.py │ ├── 36.有效的数独.py │ ├── 58.最后一个单词的长度.py │ ├── 71.简化路径.py │ ├── index.md │ └── 秒杀5道公共祖先问题.md │ ├── 时间调度问题 │ ├── 252.会议室.ts │ └── 253.会议室II.ts │ ├── 最大频率栈 │ ├── 895. Maximum Frequency Stack.ts │ ├── 895.go │ └── test.ts │ ├── 贪心算法 │ └── 134. 加油站.ts │ └── 链表 │ ├── 141. 环形链表.ts │ ├── 142. 环形链表 II.ts │ ├── 160. 相交链表.ts │ ├── 19. 删除链表的倒数第 N 个结点.py │ ├── 19. 删除链表的倒数第 N 个结点.ts │ ├── 21. 合并两个有序链表.ts │ ├── 23. 合并K个升序链表(hard).ts │ ├── 237. 删除链表中的节点.ts │ └── 876. 链表的中间结点.ts ├── 2.剑指Offer ├── 0 test.js ├── BFS_广度遍历_√ │ ├── 13机器人的运动范围.js │ ├── 32 - I. 从上到下打印二叉树.js │ ├── 32 - II. 从上到下打印二叉树 II.js │ └── 32 - III. 从上到下打印二叉树 III.js ├── DFS_深度遍历_√ │ ├── 27. 二叉树的镜像.js │ ├── 28. 对称的二叉树.js │ ├── 33. 二叉搜索树的后序遍历序列.js │ ├── 35. 复杂链表的复制.js │ ├── 36. 二叉搜索树与双向链表.js │ ├── 38. 字符串的排列.js │ ├── 54. 二叉搜索树的第 k 大节点.js │ ├── 55 - I. 二叉树的深度.js │ └── 55 - II. 平衡二叉树.js ├── 二叉树_√ │ ├── 68 - I. 二叉搜索树的最近公共祖先.js │ ├── 68 - II. 二叉树的最近公共祖先.js │ └── 7重建二叉树.js ├── 位运算_√ │ ├── 15二进制中1的个数.js │ ├── 43. 1~n整数中1出现的次数.js │ ├── 56 - I. 数组中数字出现的次数.js │ └── 65. 不用加减乘除做加法.js ├── 动态规划_√ │ ├── 10 斐波那契数列.js │ ├── 10 青蛙跳台阶.js │ ├── 12 矩阵中的最短路径.js │ ├── 13机器人的运动范围 copy.js │ ├── 14剪绳子.js │ ├── 14剪绳子2_大数取模.js │ ├── 19. 正则表达式匹配 copy.js │ ├── 42. 连续子数组的最大和.js │ ├── 46. 把数字翻译成字符串.js │ ├── 47. 礼物的最大价值.js │ ├── 49. 丑数.js │ ├── 60. n个骰子的点数.js │ ├── 62. 圆圈中最后剩下的数字.js │ ├── 63. 股票的最大利润.js │ └── test.js ├── 哈希表_√ │ ├── 2二维数组中的查找.js │ ├── 3. 数组中重复的数字.js │ └── 50. 第一个只出现一次的字符.js ├── 回溯法_试探法_√ │ └── 34. 二叉树中和为某一值的路径.js ├── 数组+字符串_√ │ ├── 11旋转数组的最小数字.js │ ├── 17打印从1到最大的n位数.js │ ├── 20. 表示数值的字符串.js │ ├── 21.调整数组顺序使奇数位于偶数前面.js │ ├── 29. 顺时针打印矩阵.js │ ├── 39. 数组中出现次数超过一半的数字.js │ ├── 40. 最小的k个数.js │ ├── 44. 数字序列中某一位的数字.js │ ├── 45. 把数组排成最小的数.js │ ├── 48. 最长不含重复字符的子字符串.js │ ├── 53 - I. 在排序数组中查找数字 I.js │ ├── 53 - II. 0- n-1中缺失的数字.js │ ├── 56 - II. 数组中数字出现的次数 II.js │ ├── 57 - I. 和为 s 的两个数字.js │ ├── 57 - II. 和为 s 的连续正数序列.js │ ├── 58 - I. 翻转单词顺序.js │ ├── 58 - II. 左旋转字符串.js │ ├── 5替换空格.js │ ├── 61. 扑克牌中的顺子.js │ ├── 66. 构建乘积数组.js │ ├── 67. 正则_把字符串转换成整数.js │ └── test.js ├── 栈和队列_√ │ ├── 30. 包含 min 函数的栈.js │ ├── 31. 栈的压入、弹出序列.js │ ├── 59 - I. 滑动窗口的最大值.js │ ├── 59 - II. 队列的最大值.js │ ├── 6从尾到头打印链表.js │ └── 9用两个栈实现队列.js ├── 正则表达式_√ │ └── 19. 正则表达式匹配.js ├── 递归_√ │ ├── 16数值的整数次方.js │ ├── 26 树的子结构.js │ ├── 33. 二叉搜索树的后序遍历序列.js │ └── 64. 求1+2+…+n .js └── 链表_√ │ ├── 18删除链表的节点.js │ ├── 22.链表中倒数的第K个节点.js │ ├── 24.反转链表.js │ ├── 25合并两个排序的链表.js │ └── 52. 两个链表的第一个公共节点.js ├── 3.Data Structure ├── 1.基础_BigInt使用.js ├── 10.基础_字符串方法.js ├── 11.基础_条件问题.js ├── 12.基础_正则表达式.js ├── 13.补充_算法方法知识点.js ├── 2.基础_JS全局方法.js ├── 3.基础_Map.js ├── 4.基础_Math.js ├── 5.基础_Number.js ├── 6.基础_Set.js ├── 7.基础_Symbol.js ├── 8.基础_对象Obj.js ├── 9.基础_数组Array.js ├── AVL.html ├── AYL树_自平衡二叉树.js ├── Heap │ ├── Heap.html │ └── heap.ts ├── Heap_Legacy │ ├── 堆_大顶堆_and堆排序.js │ ├── 堆_小顶堆.html │ └── 堆_小顶堆.js ├── Node中Buffer对象.js ├── temp.html ├── temp.js ├── 二叉树 copy.html ├── 二叉树.html ├── 二叉树.js ├── 二叉树_红黑树.html ├── 二叉树_红黑树.js ├── 优先级队列_最小堆.ts ├── 双向链表.html ├── 双向链表.js ├── 双端队列.js ├── 双端队列_对象实现.html ├── 哈希表.js ├── 哈希表_分离链接.js ├── 哈希表_分离链表.html ├── 图.js ├── 图_BFS遍历_最短路径问题.js ├── 图_DFS遍历_最短路径问题.js ├── 图_拓扑排序.js ├── 字典.html ├── 字典_Map类.js ├── 字典_Obj类.js ├── 循环链表.js ├── 有序列表.js ├── 栈.js ├── 矩阵.js ├── 递归.js ├── 链表.html ├── 链表.js ├── 链表_新实现.html ├── 链表_新实现.js ├── 队列.js ├── 集合_Obj类实现.js ├── 集合_Set类实现.js └── 集合_Set结构直接实现.js ├── 4.Basic Challenge ├── 00Leetcode题目.js ├── 00测试.js ├── 1 反转字符串.js ├── 10排序_选择排序.js ├── 11排序_插入排序.js ├── 12排序_归并排序_就是二叉树的后序遍历.js ├── 13排序_快速排序_就是二叉树的前序遍历.js ├── 14八皇后问题.js ├── 14八皇后问题self.js ├── 15.背包问题.js ├── 16递归的缺点以及解决方案.js ├── 17贪心算法_人民币支付.js ├── 18动态规划_分糖果.js ├── 19回溯法_轮船装集装箱.js ├── 1_数组拆分.js ├── 1_深浅拷贝.js ├── 1_转置算法.js ├── 2 无重复字符串.js ├── 20.数组去重.js ├── 21_单词是否是回文.js ├── 22_字符串出现次数最多的字母.js ├── 23_随机生成指定长度的字符串.js ├── 24_字符串加密解密.js ├── 25url加密解密.html ├── 25url加密解密.js ├── 26斐波那契数列.js ├── 27阶乘.js ├── 28字符串前后匹配.html ├── 28字符串前后匹配.js ├── 29任意进制转换.js ├── 29堆排序.js ├── 3数组最大值方法.js ├── 4 种花问题.js ├── 5 求数组min之和.js ├── 6卡牌分组.js ├── 7正则-验证密码.js ├── 8 八皇后问题.js ├── 8 只要一个解的八皇后问题.js ├── 8 正则表达式匹配.js └── 9排序_冒泡排序.js ├── 5.Daily Challenge ├── 0_227. 基本计算器 II.js ├── 0_Interview Question_Tuple.js ├── 0_JS常见位操作.js ├── 0_二分搜索复习.js ├── 0_基础_BigInt使用.js ├── 0_复杂度.js ├── 0_归并排序复习.js ├── 0_技巧总结.js ├── 0_最大公约数_最小公倍数.js ├── 0_详解最长公共子序列问题,秒杀三道动态规划题目.js ├── 1004. 最大连续1的个数 III.js ├── 1006. 笨阶乘.js ├── 1010. 总持续时间可被 60 整除的歌曲.js ├── 1015. 可被 K 整除的最小整数.js ├── 1026. 节点与其祖先之间的最大差值.js ├── 103.二叉树的锯齿形层序遍历.js ├── 1030.距离顺序排列矩阵单元格.js ├── 104. 二叉树的最大深度.js ├── 1046. 最后一块石头的重量.js ├── 1081. 不同字符的最小子序列.js ├── 1099. 小于 K 的两数之和.js ├── 110. 平衡二叉树.js ├── 116. 填充每个节点的下一个右侧节点指针.js ├── 117. 填充每个节点的下一个右侧节点指针 II.js ├── 118.杨辉三角.js ├── 1207. 独一无二的出现次数.js ├── 123. 买卖股票的最佳时机 III.js ├── 1269. 停在原地的方案数.js ├── 127.单词接龙.js ├── 1272. 删除区间.js ├── 129. 求根到叶子节点数字之和.js ├── 13. 罗马数字转整数.ts ├── 1306. 跳跃游戏 III.js ├── 131. 分割回文串.js ├── 134. 加油站.js ├── 1345. 跳跃游戏 IV.js ├── 1356. 根据数字二进制下 1 的数目排序.js ├── 1365. 有多少小于当前数字的数字.js ├── 137. 只出现一次的数字 II.js ├── 139. 单词拆分.js ├── 140. 单词拆分 II.JS ├── 144. 二叉树的前序遍历.js ├── 1457. 二叉树中的伪回文路径.js ├── 147. 对链表进行插入排序(升序排序).js ├── 148. 升序排序链表.js ├── 1492. n 的第 k 个因子.js ├── 1602. 找到二叉树中最近的右侧节点.js ├── 164. 最大间距.js ├── 173. 二叉搜索树迭代器.js ├── 188. 买卖股票的最佳时机 IV.js ├── 189. 旋转数组.js ├── 204.计算质数.js ├── 205. 同构字符串.js ├── 216. 组合总和 III.js ├── 217. 存在重复元素.ts ├── 220.存在重复元素3.ts ├── 230. Kth Smallest Element in a BST.js ├── 234. Palindrome Linked List.js ├── 236. Lowest Common Ancestor of a Binary Tree.js ├── 237. Delete Node in a Linked List.js ├── 238. Product of Array Except Self.js ├── 239. Sliding Window Maximum.js ├── 239. 滑动窗口最大值.ts ├── 24. 两两交换链表中的节点.js ├── 240. Search a 2D Matrix II.js ├── 242. Valid Anagram.js ├── 242. 有效的字母异位词.js ├── 251. Flatten 2D Vector.js ├── 252.会议室.js ├── 253.会议室II.js ├── 268. Missing Number.js ├── 269. Alien Dictionary.js ├── 277.搜索名人.js ├── 278. 第一个错误的版本.ts ├── 279. Perfect Squares.js ├── 279. 完全平方数.ts ├── 283.移动零.js ├── 289. 生命游戏.js ├── 290. 单词规律.js ├── 31.下一个大一些的排列.js ├── 312.戳气球.js ├── 316. 去除重复字母.js ├── 321. 拼接最大数.js ├── 327. 区间和的个数.js ├── 33. 搜索旋转排序数组.js ├── 334. 递增的三元子序列.js ├── 337. 打家劫舍 III.js ├── 34. 二分_在排序数组中查找元素的位置.js ├── 349. 两个数组的交集.js ├── 369. 给单链表加一.js ├── 376. 摆动序列.js ├── 377. 组合总和 Ⅳ.js ├── 381.O(1) 时间插入、删除和获取随机元素 - 允许重复.js ├── 382. 链表随机节点.js ├── 387. 字符串中的第一个唯一字符.js ├── 389. 找不同.js ├── 39.组合总和.js ├── 394. 字符串解码.js ├── 395. 至少有K个重复字符的最长子串.js ├── 40. 组合总和 II.js ├── 402移掉K位数字.js ├── 424.替换后的最长重复字符串.js ├── 445.两数相加ll .js ├── 452. 用最少数量的箭引爆气球.js ├── 454. 四数相加 II.js ├── 455. 分发饼干.js ├── 463. 岛屿的周长.js ├── 47. 全排列 II.js ├── 48. 旋转图像.js ├── 49. 字母异位词分组.js ├── 493. 翻转对.js ├── 498. 对角线遍历.js ├── 509. 斐波那契数.js ├── 53. 最大子序和.js ├── 538. 把二叉搜索树转换为累加树.js ├── 54. 螺旋矩阵.js ├── 554. 砖墙.ts ├── 556. 下一个更大元素 III.js ├── 56.合并区间.js ├── 563. 二叉树的坡度.js ├── 567. 字符串的排列.js ├── 57.插入区间.js ├── 59. 螺旋矩阵 II.js ├── 593. 有效的正方形.js ├── 605. 种花问题1206.js ├── 62.机器人到终点的不同路径.js ├── 621. 任务调度器1206.js ├── 633. 平方数之和.js ├── 64. 最小路径和.js ├── 643. 子数组最大平均数 I.js ├── 644. 最大平均子段和 II.js ├── 649. Dota2 参议院.js ├── 659. 未解决_分割数组为连续子序列.js ├── 690. 员工的重要性.js ├── 697. 数组的度.js ├── 7. 整数反转.ts ├── 714. 买卖股票的最佳时机含手续费.js ├── 738. 单调递增的数字.js ├── 740. 删除并获得点数.ts ├── 746. 使用最小花费爬楼梯.js ├── 754. 到达终点数字.js ├── 766.托普利茨矩阵.js ├── 767.重构字符串.js ├── 8.桶排序复习.js ├── 80.删除排序数组中的重复项 II.js ├── 804. 唯一摩尔斯密码词.js ├── 81.搜索旋转排序数组 II.js ├── 830. 较大分组的位置.js ├── 832. 翻转图像.js ├── 842. 将数组拆分成斐波那契序列1207.js ├── 845. 数组中的最长山脉.js ├── 85. 最大矩形 困难.js ├── 858.镜面反射.js ├── 86. 分隔链表.js ├── 860. 柠檬水找零.js ├── 861. 翻转矩阵后的得分_1206.js ├── 865. 具有所有最深节点的最小子树.js ├── 867. 转置矩阵.js ├── 872. 叶子相似的树.ts ├── 880. 索引处的解码字符串.js ├── 888. 公平的糖果棒交换.js ├── 897. 递增顺序查找树.js ├── 9.基数排序.js ├── 91. 解码方法.js ├── 910. 最小差值 II.js ├── 92.反转链表 II.js ├── 941. 有效的山脉数组.js ├── 973. 最接近原点的 K 个点.js ├── 976. 三角形的最大周长.js ├── 977. 有序数组的平方.js ├── 978. 最长湍流子数组.js ├── 98. 验证二叉搜索树.js ├── BFS │ ├── 102. Binary Tree Level Order Traversal.js │ ├── 103. Binary Tree Zigzag Level Order Traversal.js │ └── 127. Word Ladder.js ├── Basic Calculator.js ├── DFS │ └── 101 Symmetric Tree.js ├── LFU使用次数最少缓存淘汰算法.js ├── LRU缓存淘汰算法.js ├── LRU缓存淘汰算法_Map.js ├── test.js ├── test123.js ├── upstairs.js ├── zesfes.js ├── 天际线问题.js └── 完全二叉树的节点个数.js ├── 6.Challenges 310p.zip ├── 6.Sorted Challenges 310p ├── 1.二分法 21 │ ├── index.md │ ├── 朴素二分法 (7) │ │ ├── 153.Find Minimum in Rotated Sorted Array.ts │ │ ├── 154.Find Minimum in Rotated Sorted Array II.ts │ │ ├── 278.First Bad Version.ts │ │ ├── 658.Find K Closest Elements.ts │ │ ├── 必背 34.Find First and Last Position of Element in Sorted Array.ts │ │ ├── 必背 702.Search in a Sorted Array of Unknown Size - 副本.ts │ │ └── 必背 704.Binary Search.ts │ ├── 条件二分法 (7) │ │ ├── 302.Smallest Rectangle Enclosing Black Pixels.ts │ │ ├── 81. Search in Rotated Sorted Array II.ts │ │ ├── 852.Peak Index in a Mountain Array.ts │ │ ├── 必背 162.Find Peak Element.ts │ │ ├── 必背 33.Search in Rotated Sorted Array.ts │ │ ├── 必背 4.Median of Two Sorted Arrays.ts │ │ └── 必背 74.Search a 2D Matrix.ts │ └── 答案二分法 6 │ │ ├── 69.Sqrt(x).ts │ │ ├── Lint-183. Wood Cut.ts │ │ ├── Lint-437. Copy Books.ts │ │ ├── Lint-438. Copy Books II.ts │ │ ├── 必背 1283.Find the Smallest Divisor Given a Threshold.ts │ │ └── 必背 875.Koko Eating Bananas.ts ├── 2.多指针 75 │ ├── index.md │ ├── 前缀和 │ │ ├── 238. Product of Array Except Self.ts │ │ ├── 303. Range Sum Query - Immutable.ts │ │ ├── 325. Maximum Size Subarray Sum Equals k.ts │ │ ├── 528. Random Pick with Weight.ts │ │ ├── 560. Subarray Sum Equals K.ts │ │ └── 重点 53. Maximum Subarray.ts │ ├── 区间 │ │ ├── 252. Meeting Rooms.ts │ │ ├── 253. Meeting Rooms II.ts │ │ ├── 56. Merge Intervals.ts │ │ ├── 57. Insert Interval.ts │ │ ├── 986. Interval List Intersections.ts │ │ └── 重点 Lint-391. Number of Airplanes in the Sky.ts │ ├── 和差问题 │ │ ├── 1099. Two Sum Less Than K.ts │ │ ├── 15. 3Sum.ts │ │ ├── 167. Two Sum II - Input array is sorted.ts │ │ ├── 170. Two Sum III - Data structure design.ts │ │ ├── 18. 4Sum.ts │ │ ├── 259. 3Sum Smaller.ts │ │ ├── 653. Two Sum IV - Input is a BST.ts │ │ ├── Lint-382. Triangle Count.ts │ │ ├── Lint-443. Two Sum - Greater than target.ts │ │ ├── Lint-533. Two Sum - Closet to target.ts │ │ ├── Lint-57. 3Sum Closest.ts │ │ ├── Lint-587. Two Sum - Unique pairs.ts │ │ ├── Lint-609. Two Sum - Less than or equals to target.ts │ │ ├── Lint-610. Two Sum - Difference equals to target.ts │ │ └── 重点 1. Two Sum.ts │ ├── 回文字符串 │ │ ├── 125. Valid Palindrome.ts │ │ ├── 重点 345. Reverse Vowels of a String.ts │ │ ├── 重点 5. Longest Palindromic Substring.ts │ │ └── 重点 680. Valid Palindrome II.ts │ ├── 数组 │ │ ├── 215.Kth Largest Element in an Array.ts │ │ ├── 283.Move Zeroes.ts │ │ ├── 347. Top K Frequent Elements.ts │ │ ├── 349. Intersection of Two Arrays.ts │ │ ├── 350. Intersection of Two Arrays II.ts │ │ ├── 42. Trapping Rain Water.ts │ │ ├── 43. Multiply Strings.ts │ │ ├── 80.Remove Duplicates from Sorted Array II.ts │ │ ├── 845. Longest Mountain in Array.ts │ │ ├── 88.Merge Sorted Array.ts │ │ ├── 969. Pancake Sorting.ts │ │ ├── Lint-143. Sort Color II.ts │ │ ├── Lint-31. Partition Array.ts │ │ ├── Lint-461. Kth Smallest Numbers in Unsorted Array.ts │ │ ├── Lint-544. Top k Largest Numbers.ts │ │ ├── Lint-625. Partition Array II.ts │ │ ├── 必背 26.Remove Duplicates from Sorted Array.ts │ │ ├── 必背 75.Sort Colors.ts │ │ └── 必背 912.Sort an Array (Quick Sort and Merge Sort).ts │ ├── 流 │ │ ├── 346. Moving Average from Data Stream.ts │ │ ├── 352. Data Stream as Disjoint Intervals.ts │ │ ├── 703. Kth Largest Element in a Stream.ts │ │ └── 重点 295. Find Median from Data Stream.ts │ ├── 滑动窗口 │ │ ├── 11. Container With Most Water.ts │ │ ├── 209. Minimum Size Subarray Sum.ts │ │ ├── 239. Sliding Window Maximum.ts │ │ ├── 395. Longest Substring with At Least K Repeating Characters.ts │ │ ├── 480. Sliding Window Median.ts │ │ ├── 567. Permutation in String.ts │ │ ├── 713. Subarray Product Less Than K.ts │ │ ├── 727. Minimum Window Subsequence.ts │ │ ├── 76. Minimum Window Substring.ts │ │ ├── Lint-604. Window Sum.ts │ │ └── 重点 3. Longest Substring Without Repeating Characters.ts │ └── 链表 │ │ ├── 141. Linked List Cycle.ts │ │ ├── 142. Linked List Cycle II.ts │ │ ├── 160. Intersection of Two Linked Lists.ts │ │ ├── 234. Palindrome Linked List.ts │ │ ├── 287. Find the Duplicate Number.ts │ │ ├── 328. Odd Even Linked List.ts │ │ ├── 86. Partition List.ts │ │ ├── 876. Middle of the Linked List.ts │ │ └── 必背 21. Merge Two Sorted Lists.ts ├── 3.广度优先搜索 BFS 33 │ ├── index.md │ ├── 二叉树 │ │ ├── 102. Binary Tree Level Order Traversal.ts │ │ ├── 103. Binary Tree Zigzag Level Order Traversal.ts │ │ ├── 107. Binary Tree Level Order Traversal II.ts │ │ ├── 513. Find Bottom Left Tree Value.ts │ │ ├── Lint-242. Convert Binary Tree to Linked Lists by Depth.ts │ │ └── 重点 297. Serialize and Deserialize Binary Tree.ts │ ├── 图 │ │ ├── 127. Word Ladder.ts │ │ ├── 1306. Jump Game III.ts │ │ ├── 261. Graph Valid Tree.ts │ │ ├── 323. Number of Connected Components in an Undirected Graph.ts │ │ ├── 841. Keys and Rooms.ts │ │ ├── Lint-531. Six Degree.ts │ │ ├── Lint-618. Search Graph Nodes.ts │ │ ├── Lint-624. Remove Substrings.ts │ │ └── 重点 133. Clone Graph.ts │ ├── 拓扑排序 │ │ ├── 207. Course Schedule.ts │ │ ├── 210. Course Schedule II.ts │ │ ├── 269. Alien Dictionary.ts │ │ ├── 444. Sequence Reconstruction.ts │ │ └── 重点 Lint-127. Topological Sorting.ts │ └── 矩阵 │ │ ├── 305. Number of Islands II.ts │ │ ├── 490. The Maze.ts │ │ ├── 505. The Maze II.ts │ │ ├── 542. 01 Matrix.ts │ │ ├── 733. Flood Fill.ts │ │ ├── 773. Sliding Puzzle.ts │ │ ├── 994. Rotting Oranges.ts │ │ ├── Lint-573. Build Post Office II.ts │ │ ├── Lint-598. Zombie in Matrix.ts │ │ ├── Lint-611. Knight Shortest Path.ts │ │ ├── Lint-794. Sliding Puzzle II.ts │ │ └── 重点 200. Number of Islands.ts ├── 4.二叉树与递归 38 │ ├── LCA问题 │ │ ├── 236. Lowest Common Ancestor of a Binary Tree.ts │ │ ├── Lint-474. Lowest Common Ancestor II.ts │ │ └── Lint-578. Lowest Common Ancestor III.ts │ ├── index.md │ ├── 其他 │ │ ├── 114. Flatten Binary Tree to Linked List.ts │ │ ├── 199. Binary Tree Right Side View.ts │ │ ├── 331. Verify Preorder Serialization of a Binary Tree.ts │ │ ├── 449. Serialize and Deserialize BST.ts │ │ └── 513. Find Bottom Left Tree Value.ts │ ├── 判断树的形态 │ │ ├── 100. Same Tree.ts │ │ ├── 101. Symmetric Tree.ts │ │ ├── 110. Balanced Binary Tree.ts │ │ └── 98. Validate Binary Search Tree.ts │ ├── 前中后序遍历 │ │ ├── 重点 144. Binary Tree Preorder Traversal.ts │ │ ├── 重点 145. Binary Tree Postorder Traversal.ts │ │ └── 重点 94. Binary Tree Inorder Traversal.ts │ ├── 反向复原二叉树 │ │ ├── 106. Construct Binary Tree from Inorder and Postorder Traversal.ts │ │ ├── 889. Construct Binary Tree from Preorder and Postorder Traversal.ts │ │ └── 重点 105. Construct Binary Tree from Preorder and Inorder Traversal.ts │ ├── 子树相关问题 │ │ ├── 104. Maximum Depth of Binary Tree.ts │ │ ├── 111. Minimum Depth of Binary Tree.ts │ │ ├── 333. Largest BST Subtree.ts │ │ ├── Lint-596. Minimum Subtree.ts │ │ └── Lint-597. Subtree with Maximum Average.ts │ ├── 路径相关问题 │ │ ├── 112. Path Sum.ts │ │ ├── 113. Path Sum II.ts │ │ ├── 124. Binary Tree Maximum Path Sum.ts │ │ ├── 298. Binary Tree Longest Consecutive Sequence.ts │ │ ├── 549. Binary Tree Longest Consecutive Sequence II.ts │ │ ├── Lint-475. Binary Tree Maximum Path Sum II.ts │ │ └── Lint-619. Binary Tree Longest Consecutive Sequence III.ts │ └── 遍历器相关 │ │ ├── 173. Binary Search Tree Iterator.java │ │ ├── 173. Binary Search Tree Iterator.ts │ │ ├── 230. Kth Smallest Element in a BST.ts │ │ ├── 270. Closest Binary Search Tree Value.ts │ │ ├── 272. Closest Binary Search Tree Value II.ts │ │ ├── 285. Inorder Successor in BST.ts │ │ ├── 510. Inorder Successor in BST II.ts │ │ └── Lint-915. Inorder Predecessor in BST II.ts ├── 5.深度优先搜索 DFS 32 │ ├── index.md │ ├── 二叉树 │ │ ├── 113. Path Sum II.ts │ │ ├── 257. Binary Tree Paths.ts │ │ ├── Lint-246. Binary Tree Path Sum II.ts │ │ ├── Lint-376. Binary Tree Path Sum.ts │ │ └── Lint-472. Binary Tree Path Sum III.ts │ ├── 图 │ │ ├── 1192. Critical Connections in a Network.ts │ │ ├── 126. Word Ladder II.ts │ │ ├── 140. Word Break II.ts │ │ ├── 290. Word Pattern.ts │ │ ├── 291. Word Pattern II.ts │ │ └── 494. Target Sum.ts │ └── 排列组合 │ │ ├── 131. Palindrome Partitioning.ts │ │ ├── 17. Letter Combinations of a Phone Number.ts │ │ ├── 22. Generate Parentheses.ts │ │ ├── 254. Factor Combinations.ts │ │ ├── 301. Remove Invalid Parentheses.ts │ │ ├── 37. Sudoku Solver.ts │ │ ├── 46. Permutations.ts │ │ ├── 491. Increasing Subsequences.ts │ │ ├── 51. N-Queens.ts │ │ ├── 52. N-Queens II.ts │ │ ├── 93. Restore IP Addresses.ts │ │ ├── Lint-10. String Permutation II.ts │ │ ├── Lint-570. Find the Missing Number II.ts │ │ ├── Lint-680. Split String.ts │ │ ├── 重点 39. Combination Sum.ts │ │ ├── 重点 40. Combination Sum II.ts │ │ ├── 重点 47. Permutations II.ts │ │ ├── 重点 77. Combinations.ts │ │ ├── 重点 78. Subsets.ts │ │ └── 重点 90. Subsets II.ts ├── 6.数据结构 76 │ ├── index.md │ ├── 二叉索引树和段树 │ │ ├── 315. Count of Smaller Numbers After Self.ts │ │ ├── 327. Count of Range Sum.ts │ │ ├── 493. Reverse Pairs.ts │ │ ├── 715. Range Module.ts │ │ └── 重点 307. Range Sum Query - Mutable.ts │ ├── 单调栈 │ │ ├── 1019. Next Greater Node In Linked List.ts │ │ ├── 239. Sliding Window Maximum.ts │ │ ├── 84. Largest Rectangle in Histogram.ts │ │ └── 重点 300. Longest Increasing Subsequence (Patience Sort).ts │ ├── 哈希表 │ │ ├── 128. Longest Consecutive Sequence.ts │ │ ├── 290. Word Pattern.ts │ │ ├── 49. Group Anagrams.ts │ │ ├── 560. Subarray Sum Equals K.ts │ │ ├── 953. Verifying an Alien Dictionary.ts │ │ └── 重点 706. Design HashMap.ts │ ├── 堆 │ │ ├── 295. Find Median from Data Stream.ts │ │ ├── 347. Top K Frequent Elements.ts │ │ ├── 480. Sliding Window Median.ts │ │ ├── 692. Top K Frequent Words.ts │ │ ├── 703. Kth Largest Element in a Stream.ts │ │ ├── 767. Reorganize String.ts │ │ ├── 973. K Closest Points to Origin.ts │ │ └── 重点 23. Merge k Sorted Lists.ts │ ├── 复杂数据结构 │ │ ├── 1396. Design Underground System.ts │ │ ├── 211. Design Add and Search Words Data Structure.ts │ │ ├── 380. Insert Delete GetRandom O(1).ts │ │ ├── 528. Random Pick with Weight.ts │ │ ├── 588. Design In-Memory File System.ts │ │ ├── 981. Time Based Key-Value Store.ts │ │ ├── 重点 146. LRU Cache.ts │ │ └── 重点 460. LFU Cache.ts │ ├── 字典树 │ │ ├── 1032. Stream of Characters.ts │ │ ├── 211. Design Add and Search Words Data Structure.ts │ │ └── 重点 208. Implement Trie (Prefix Tree).ts │ ├── 字符串 │ │ ├── 13. Roman to Integer.ts │ │ ├── 14. Longest Common Prefix.ts │ │ ├── 443. String Compression.ts │ │ ├── 6. ZigZag Conversion.ts │ │ └── 68. Text Justification.ts │ ├── 并查集 │ │ ├── 305. Number of Islands II.ts │ │ ├── 323. Number of Connected Components in an Undirected Graph.ts │ │ └── 重点 200. Number of Islands.ts │ ├── 扫描线 │ │ ├── 252. Meeting Rooms.ts │ │ ├── 253. Meeting Rooms II.ts │ │ └── Lint-391. Number of Airplanes in the Sky.ts │ ├── 数组 │ │ ├── 289. Game of Life.ts │ │ ├── 442. Find All Duplicates in an Array.ts │ │ ├── 48. Rotate Image.ts │ │ ├── 54. Spiral Matrix.ts │ │ └── 73. Set Matrix Zeroes.ts │ ├── 栈 │ │ ├── 1249. Minimum Remove to Make Valid Parentheses.ts │ │ ├── 20. Valid Parentheses.ts │ │ ├── 224. Basic Calculator.ts │ │ ├── 227. Basic Calculator II.ts │ │ ├── 394. Decode String.ts │ │ ├── 85. Maximal Rectangle.ts │ │ └── 重点 155. Min Stack.ts │ └── 链表 │ │ ├── 138. Copy List with Random Pointer.ts │ │ ├── 141. Linked List Cycle.ts │ │ ├── 142. Linked List Cycle II.ts │ │ ├── 148. Sort List.ts │ │ ├── 160. Intersection of Two Linked Lists.ts │ │ ├── 203. Remove Linked List Elements.ts │ │ ├── 206. Reverse Linked List.ts │ │ ├── 234. Palindrome Linked List.ts │ │ ├── 25. Reverse Nodes in k-Group.py │ │ ├── 25. Reverse Nodes in k-Group.ts │ │ ├── 328. Odd Even Linked List.ts │ │ ├── 445. Add Two Numbers II.ts │ │ ├── 82. Remove Duplicates from Sorted List II.py │ │ ├── 83. Remove Duplicates from Sorted List.py │ │ ├── 86. Partition List.ts │ │ ├── 876. Middle of the Linked List.ts │ │ ├── 92. Reverse Linked List II.ts │ │ ├── 重点 2. Add Two Numbers.ts │ │ └── 重点 21. Merge Two Sorted Lists.ts ├── 7.动态规划DP 42 │ ├── Greedy贪心 │ │ ├── 45. Jump Game II.ts │ │ ├── 55. Jump Game.ts │ │ └── 763. Partition Labels.ts │ ├── Sections │ │ ├── 87. Scramble String.ts │ │ ├── 重点 312. Burst Balloons.ts │ │ └── 重点 516. Longest Palindromic Subsequence.ts │ ├── index.md │ ├── 其他 │ │ ├── 132. Palindrome Partitioning II.ts │ │ ├── 279. Perfect Squares.ts │ │ ├── 639. Decode Ways II.ts │ │ ├── Lint-395. Coins in a Line II.ts │ │ ├── Lint-396. Coins in a Line III.ts │ │ ├── 重点 91. Decode Ways.ts │ │ └── 重点 Lint-394. Coins in a Line.ts │ ├── 单序列 │ │ ├── 122. Best Time to Buy and Sell Stock II.ts │ │ ├── 123. Best Time to Buy and Sell Stock III.ts │ │ ├── 188. Best Time to Buy and Sell Stock IV.ts │ │ ├── 256. Paint House.ts │ │ ├── 265. Paint House II.ts │ │ ├── Lint-843. Digital Flip.ts │ │ ├── 重点 121. Best Time to Buy and Sell Stock.ts │ │ └── 重点 139. Word Break.ts │ ├── 双序列 │ │ ├── 1143. Longest Common Subsequence.ts │ │ ├── 115. Distinct Subsequences.ts │ │ ├── 44. Wildcard Matching.ts │ │ ├── 72. Edit Distance.ts │ │ ├── 97. Interleaving String.ts │ │ └── 重点 10. Regular Expression Matching.ts │ ├── 矩阵 │ │ ├── 221. Maximal Square.ts │ │ ├── 361. Bomb Enemy.ts │ │ ├── 64. Minimum Path Sum.ts │ │ ├── 85. Maximal Rectangle.ts │ │ ├── 重点 62. Unique Paths.ts │ │ └── 重点 63. Unique Paths II.ts │ └── 背包问题 │ │ ├── 474. Ones and Zeroes.ts │ │ ├── Lint-125. Backpack II.ts │ │ ├── Lint-440. Backpack III.ts │ │ ├── Lint-562. Backpack IV.ts │ │ ├── Lint-563. Backpack V.ts │ │ ├── Lint-564. Backpack VI (Combination Sum IV).ts │ │ ├── Lint-971. Surplus Value Backpack.ts │ │ └── 重点 Lint-92. Backpack.ts └── 胖头龙的咸鱼刷题笔记-算法篇.md ├── 7.Canada Collections 110p ├── BFS │ ├── 图 │ │ ├── 1091. Shortest Path in Binary Matrix.ts │ │ ├── 1293. Shortest Path in a Grid with Obstacles Elimination.ts │ │ ├── 130. Surrounded Regions.ts │ │ ├── 752. Open the Lock.ts │ │ └── 815. Bus Routes.ts │ └── 树 │ │ └── 314 Binary Tree Vertical Order Traversal.ts ├── Binary Search │ ├── 显式二分法 │ │ ├── 1095. Find in Mountain Array.ts │ │ └── 240. Search a 2D Matrix II.ts │ └── 隐式二分法 │ │ ├── 1060. Missing Element in Sorted Array.ts │ │ ├── 1062. Longest Repeating Substring.ts │ │ ├── 1300. Sum of Mutated Array Closest to Target.ts │ │ ├── 1891. Cutting Ribbons.ts │ │ ├── 540. Single Element in a Sorted Array.ts │ │ └── 644. Maximum Average Subarray II.ts ├── DFS │ ├── 二叉搜索树BST │ │ ├── 108 Convert Sorted Array to Binary Search Tree.ts │ │ ├── 235 Lowest Common Ancestor of a Binary Search Tree.ts │ │ ├── 669 Trim a Binary Search Tree.ts │ │ └── 700 Search in a Binary Search Tree.ts │ ├── 图 │ │ ├── 1087 Brace Expansion.ts │ │ ├── 1274 Number of Ships in a Rectangle.ts │ │ ├── 1376 Time Needed to Inform All Employees.ts │ │ ├── 212 Word Search II (I, II).ts │ │ ├── 341 Flatten Nested List Iterator (339 364).ts │ │ ├── 399 Evaluate Division.ts │ │ ├── 586 Score of Parentheses.ts │ │ └── 694 Number of Distinct Islands.ts │ ├── 排列组合 │ │ ├── 526 Beautiful Arrangement (similar to 46).ts │ │ └── 698 Partition to K Equal Sum Subsets.ts │ ├── 树 │ │ ├── 1110 Delete Nodes And Return Forest.ts │ │ ├── 1485 Clone Binary Tree With Random Pointer.ts │ │ ├── 226 Invert Binary Tree.ts │ │ ├── 543 Diameter of Binary Tree.ts │ │ ├── 572 Subtree of Another Tree.ts │ │ ├── 863 All Nodes Distance K in Binary Tree.ts │ │ ├── 951 Flip Equivalent Binary Trees.ts │ │ └── 987 Vertical Order Traversal of a Binary Tree.ts │ └── 记忆化搜索 │ │ ├── 1216 Valid Palindrome III.ts │ │ ├── 1235 Maximum Profit in Job Scheduling.ts │ │ ├── 1335 Minimum Difficulty of a Job Schedule.ts │ │ ├── 329 Longest Increasing Path in a Matrix.ts │ │ ├── 377 Combination Sum IV.ts │ │ ├── 403 Frog Jump.ts │ │ └── 472 Concatenated Words.ts ├── Dynamic Table │ ├── 1043 Partition Array for Maximum Sum.ts │ ├── 1048 Longest String Chain.ts │ ├── 1062 Longest Repeating Substring (dp 方法与 longest common substring 一致).ts │ ├── 1140 Stone Game II.ts │ ├── 1235 Maximum Profit in Job Scheduling (DP + binary search).ts │ ├── 1277 Count Square Submatrices with All Ones (可以使用 221 一样的解法).ts │ ├── 174 Dungeon Game.ts │ ├── 198 House Robber.ts │ ├── 213 House Robber II.ts │ ├── 32 Longest Valid Parentheses.ts │ ├── 322 Coin Change.ts │ ├── 354 Russian Doll Envelopes (接龙型 dp, 300 的 2D 版).ts │ ├── 368 Largest Divisible Subset (接龙型 dp).ts │ ├── 518 Coin Change II (01 背包型).ts │ ├── 674 Longest Continuous Increasing Subsequence (接龙型 dp).ts │ ├── 70 Climbing Stairs.ts │ ├── 712 Minimum ASCII Delete Sum for Two Strings.ts │ ├── 718 Maximum Length of Repeated Subarray (和 1062 本质上一样).ts │ └── 740 Delete and Earn.ts ├── Hashmap │ ├── 146. LRU Cache (Python 中可以使用 OrderedDict 来代替).ts │ ├── 299. Bulls and Cows.ts │ └── 348 Design Tic-Tac-Toe.ts ├── Heap/Priority Queue │ ├── 1086. High Five.ts │ ├── 1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit (这个题用单调双端队列、TreeMap、双 heap 都可以).ts │ ├── 264. Ugly Number II.ts │ ├── 378. Kth Smallest Element in a Sorted Matrix.ts │ └── 895. Maximum Frequency Stack.ts ├── Monotone Stack (Queue) │ ├── 503 Next Greater Element II.ts │ ├── 739 Daily Temperatures.ts │ ├── 901 Online Stock Span.ts │ └── 907 Sum of Subarray Minimums (与 84 类似).ts ├── Prefix Sum │ ├── 1031 Maximum Sum of Two Non-Overlapping Subarrays.ts │ ├── 1423 Maximum Points You Can Obtain from Cards.ts │ ├── 304 Range Sum Query 2D - Immutable.ts │ └── 523 Continuous Subarray Sum.ts ├── Queue │ ├── 1429. First Unique Number.ts │ ├── 225. Implement Stack using Queues.ts │ ├── 281. Zigzag Iterator.ts │ └── 362. Design Hit Counte.ts ├── Sort │ ├── 179.Largest Number.ts │ └── 27.Remove elements.ts ├── Stack │ ├── 1209. Remove All Adjacent Duplicates in String II.ts │ ├── 1472. Design Browser History.ts │ ├── 150. Evaluate Reverse Polish Notation.ts │ ├── 232. Implement Queue using Stacks.ts │ └── 735. Asteroid Collisio.ts ├── Sweep Line │ ├── 218 The Skyline Problem.ts │ └── 759 Employee Free Time.ts ├── TreeMap │ ├── 318 Count of Smaller Numbers After Self (这个题线段树、二分索引树、TreeMap 都可以).ts │ ├── 729 My Calendar I.ts │ ├── 846 Hand of Straights.ts │ └── index.md ├── Trie 字典树 │ ├── 1268 Search Suggestions System.ts │ └── 212 Word Search II.ts ├── Two Pointers │ ├── 同向双指针 难 │ │ ├── 1004 Max Consecutive Ones II.ts │ │ ├── 340. Longest Substring with At Most K Distinct Characters.ts │ │ └── 424. Longest Repeating Character Replacement.ts │ ├── 相向双指针 │ │ ├── 1. Two Sum (这里使用的是先排序的双指针算法,不同于hashmap做法).ts │ │ ├── 16. 3Sum Closest.ts │ │ ├── 277. Find the Celebrity.ts │ │ └── 454. 4Sum II.ts │ └── 背向双指针 │ │ └── 409. Longest Palindrome.ts ├── Union Find │ ├── 547 Number of Provinces.ts │ ├── 721 Accounts Merge.ts │ └── 737 Sentence Similarity II.ts ├── index.py ├── 分类刷题总结.md └── 分类说明.md ├── 8.Huahua-leetcode ├── 1.Tree │ ├── 144. Binary Tree Preorder Traversal.java │ ├── 145. Binary Tree Postorder Traversal.java │ ├── 429. N-ary Tree Level Order Traversal.java │ ├── 94. Binary Tree Inorder Traversal Problem.java │ ├── 987Vertical Order Traversal of a Binary Tree.java │ └── test.java └── java常用数据结构.md ├── Algorithm-JS.iml ├── README.md ├── package-lock.json ├── package.json └── tsconfig.json /.gitignore: -------------------------------------------------------------------------------- 1 | # dependencies 2 | /node_modules 3 | yarn.lock -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | trailingComma: "es6", 3 | tabWidth: 4, 4 | semi: false, 5 | singleQuote: false, 6 | }; 7 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/1.必备算法框架/3_DFS与BFS使用范围.js: -------------------------------------------------------------------------------- 1 | /* 2 | > BFS 适用于最短类问题(最小,最少)。会用到队列queue[], 同时必须用Set做备忘录,防止重复。 3 | > 每一步就是一层搜索,集体行动 4 | > BFS搜索过程中遇到的解一定是离根最近的,所以遇到一个解,一定就是最优解,此时搜索算法可以终止。 5 | 6 | >双向BFS 使用时必须知道终点是什么。 7 | > 从起点和终点同时开始扩散,当两边有交集的时候停止。 8 | 9 | > DFS 适用搜索全部的解,或者必须要走到最深处的问题。 10 | > 会优先访问没有访问过的点,属于 单打独斗 11 | > 不需要保存搜索过程中的状态,空间复杂度低。 12 | > 递归深度 N 最好不要过大.像二维数组的题目,N小于20的,适用DFS。 13 | > 而一般 N<= 200,N<=1000这种,一定不能用DFS去做。会爆栈 14 | 15 | 16 | 17 | >特例 如果遇到二维数组,则DFS 和 BFS 均可, 只要 N 不是特别大。 18 | 19 | */ -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/Kruskal最小生成树算法/Kruskal算法/index.assets/image-20211110190005995.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/Kruskal最小生成树算法/Kruskal算法/index.assets/image-20211110190005995.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/Kruskal最小生成树算法/Kruskal算法/index.assets/image-20211110190557406.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/Kruskal最小生成树算法/Kruskal算法/index.assets/image-20211110190557406.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/Kruskal最小生成树算法/Kruskal算法/tempCodeRunnerFile.ts: -------------------------------------------------------------------------------- 1 | 2 | console.log(edges) -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/Prim算法/index.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/Prim算法/index.ts -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/二分图/index.assets/image-20211109195657727.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/二分图/index.assets/image-20211109195657727.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/二分图/index.assets/image-20211109195758476.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/二分图/index.assets/image-20211109195758476.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205259544.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205259544.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205329402.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205329402.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205448827.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205448827.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205958477.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109205958477.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109210254277.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109210254277.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109212508193.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/图-并查集Union Find算法/index.assets/image-20211109212508193.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/拓扑排序 环检测/index.assets/image-20211108200919765.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/拓扑排序 环检测/index.assets/image-20211108200919765.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/拓扑排序 环检测/index.assets/image-20211108201515013.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/拓扑排序 环检测/index.assets/image-20211108201515013.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/16.图/拓扑排序 环检测/index.assets/image-20211108201526738.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/16.图/拓扑排序 环检测/index.assets/image-20211108201526738.png -------------------------------------------------------------------------------- /1.算法框架_labuladong/18.未分类题目/292.Nim游戏.js: -------------------------------------------------------------------------------- 1 | /* 2 | 你和你的朋友,两个人一起玩 Nim 游戏:桌子上有一堆石头, 3 | 每次你们轮流拿掉 1 - 3 块石头。 拿掉最后一块石头的人就是获胜者。 4 | 你作为先手。 5 | 6 | 你们是聪明人,每一步都是最优解。 编写一个函数, 7 | 来判断你是否可以在给定石头数量的情况下赢得游戏。 8 | */ 9 | /* 10 | 输入: 4 11 | 输出: false 12 | 解释: 如果堆中有 4 块石头,那么你永远不会赢得比赛; 13 |   因为无论你拿走 1 块、2 块 还是 3 块石头,最后一块石头总是会被你的朋友拿走。 14 | */ 15 | var canWinNim = function(n) { 16 | // 如果上来就踩到 4 的倍数,那就认输吧 17 | // 否则,可以把对方控制在 4 的倍数,必胜 18 | return n % 4 != 0; 19 | }; -------------------------------------------------------------------------------- /1.算法框架_labuladong/18.未分类题目/384. 打乱数组.js: -------------------------------------------------------------------------------- 1 | 2 | // ! 384 打乱数组 3 | 4 | // 写成class 5 | class Solution { 6 | constructor(nums){ 7 | this.nums=nums 8 | } 9 | reset=()=> this.nums; 10 | shuffle=()=>{ 11 | let copy=Array.from(this.nums) 12 | let n=copy.length; 13 | for (let i = 0; i < copy.length; i++) { 14 | // i可以从0开始,因此不用+1; 15 | const random = Math.floor( (Math.random()*(n-i)) +i );// [i,n]才能保证是可能性是n! 16 | [copy[random],copy[i]]=[copy[i],copy[random]] 17 | } 18 | return copy 19 | } 20 | 21 | randOne=(n, m)=> Math.floor(Math.random() * (m+1 - n)) + n;//[m,n] 22 | } -------------------------------------------------------------------------------- /1.算法框架_labuladong/18.未分类题目/83.删除排序链表中的重复元素.js: -------------------------------------------------------------------------------- 1 | // ! 有序链表去重 2 | 3 | function deleteDuplicates(head) { 4 | if (head == null) return null; 5 | let slow = head, fast = head; 6 | while (fast != null) { 7 | if (fast.val != slow.val) { 8 | slow.next = fast; 9 | slow = slow.next; 10 | } 11 | fast = fast.next; 12 | } 13 | // 断开与后面重复元素的连接 14 | slow.next = null; 15 | return head; 16 | } -------------------------------------------------------------------------------- /1.算法框架_labuladong/18.未分类题目/877石头游戏.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/18.未分类题目/877石头游戏.js -------------------------------------------------------------------------------- /1.算法框架_labuladong/18.未分类题目/test.js: -------------------------------------------------------------------------------- 1 | let str="abcdefg"; 2 | str[0]='???' 3 | console.log(str); 4 | 5 | let dp = new Array(4).fill(0).map((item,index,self)=>{ 6 | return self=new Array(6).fill(0) 7 | }); 8 | console.log(dp); -------------------------------------------------------------------------------- /1.算法框架_labuladong/19.高频面试题/20.有效的括号.js: -------------------------------------------------------------------------------- 1 | function isValid(str) { 2 | let left = [] //栈 3 | for (let c of str) { 4 | if (c == '(' || c == '{' || c == '[') left.push(c) 5 | // 字符 c 是右括号 6 | else if (left.length !== 0 && leftOf(c) == left[left.length - 1]) left.pop() 7 | // 和最近的左括号不匹配 8 | else return false 9 | } 10 | // 是否所有的左括号都被匹配了 11 | return left.length === 0 12 | } 13 | 14 | function leftOf(c) { 15 | if (c == '}') return '{' 16 | if (c == ')') return '(' 17 | return '[' 18 | } 19 | 20 | console.log(isValid('{{()[]}}')) 21 | console.log(isValid('{{()[(]}}')) 22 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/19.高频面试题/test.js: -------------------------------------------------------------------------------- 1 | let arr=[0,1,2,3,4,5,100]; 2 | arr=arr.filter((v,i)=>v!==100) 3 | console.log(arr); -------------------------------------------------------------------------------- /1.算法框架_labuladong/2.排序算法 合集/1.冒泡排序.js: -------------------------------------------------------------------------------- 1 | 2 | function bubbleSort(arr){ 3 | for(let i = 1;i < arr.length;i++){ 4 | for(let j = i;j > 0;j--){ 5 | if(arr[j-1]>arr[j]){ 6 | [arr[j-1],arr[j]]=[arr[j],arr[j-1]]; 7 | } 8 | } 9 | } 10 | return arr; 11 | } 12 | let list =[1,2,3,100,99,-1,3,10,-200]; 13 | console.log(bubbleSort(list)); 14 | 15 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/2.排序算法 合集/3.插入排序.js: -------------------------------------------------------------------------------- 1 | function insertSort(arr) { 2 | let len = arr.length 3 | if (!Array.isArray(arr) || len <= 1) return 4 | for (let i = 1; i < len; i++) { 5 | let j = i - 1 6 | // 之前的值大? 7 | if (arr[j] > arr[i]) { 8 | let temp = arr[i] 9 | while (j >= 0 && temp < arr[j]) { 10 | arr[j + 1] = arr[j] 11 | j-- 12 | } 13 | arr[j + 1] = temp 14 | } 15 | } 16 | return arr 17 | } 18 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉搜索树/index.md: -------------------------------------------------------------------------------- 1 | 9 | 10 | 从做算法题的角度来看 BST,除了它的定义,还有一个重要的性质:==BST 的中序遍历结果是有序的(升序)。== 11 | 12 | 也就是说,如果输入一棵 BST,以下代码可以将 BST 中每个节点的值升序打印出来: 13 | 14 | void traverse(TreeNode root) { 15 | if (root == null) return; 16 | traverse(root.left); 17 | // 中序遍历代码位置 18 | print(root.val); 19 | traverse(root.right); 20 | } 21 | 那么根据这个性质,我们来做两道算法题。 22 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉搜索树/第一期/230寻找第 K 小的元素.java: -------------------------------------------------------------------------------- 1 | 2 | class Solution { 3 | public int kthSmallest(TreeNode root, int k) { 4 | traverse(root, k); 5 | return res; 6 | } 7 | 8 | int res = 0; 9 | int rank = 0; 10 | 11 | void traverse(TreeNode root, int k) { 12 | if (root == null) { 13 | return; 14 | } 15 | traverse(root.left, k); 16 | rank++; 17 | if (k == rank) { 18 | res = root.val; 19 | return; 20 | } 21 | traverse(root.right, k); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉搜索树/第一期/230寻找第 K 小的元素.ts: -------------------------------------------------------------------------------- 1 | namespace LeetCode230_1 { 2 | function kthSmallest(root: TreeNode, k: number) { 3 | let res = 0 4 | let rank = 0 5 | const traverse = (root: TreeNode, k: number) => { 6 | if (!root) return 7 | traverse(root.left, k) 8 | rank++ 9 | if (k == rank) { 10 | res = root.val 11 | return 12 | } 13 | traverse(root.right, k) 14 | } 15 | traverse(root, k) 16 | return res 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉搜索树/第一期/530二叉搜索树转为累加树.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | private int sum = 0; 3 | 4 | public TreeNode convertBST(TreeNode root) { 5 | traverse(root); 6 | return root; 7 | } 8 | 9 | public void traverse(TreeNode root) { 10 | if (root == null) { 11 | return; 12 | } 13 | traverse(root.right); 14 | 15 | // root 16 | sum += root.val; 17 | root.val = sum; 18 | traverse(root.left); 19 | } 20 | } 21 | 22 | /* 23 | * 24 | * 这段代码可以从大到小降序打印 BST 节点的值,如果维护一个外部累加变量sum,然后把sum赋值给 BST 中的每一个节点,不就将 BST 25 | * 转化成累加树了吗? 26 | * 27 | */ -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉搜索树/第一期/TreeNode.java: -------------------------------------------------------------------------------- 1 | public class TreeNode { 2 | int val; 3 | TreeNode left; 4 | TreeNode right; 5 | 6 | TreeNode() { 7 | } 8 | 9 | TreeNode(int val) { 10 | this.val = val; 11 | } 12 | 13 | TreeNode(int val, TreeNode left, TreeNode right) { 14 | this.val = val; 15 | this.left = left; 16 | this.right = right; 17 | } 18 | } -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉搜索树/第二期/在 BST 中插入一个数.java: -------------------------------------------------------------------------------- 1 | public class Solution { 2 | TreeNode insertIntoBST(TreeNode root, int val) { 3 | // 找到空位置插入新节点 4 | if (root == null) 5 | return new TreeNode(val); 6 | // if (root.val == val) 7 | // BST 中一般不会插入已存在元素 8 | if (root.val < val) 9 | root.right = insertIntoBST(root.right, val); 10 | if (root.val > val) 11 | root.left = insertIntoBST(root.left, val); 12 | return root; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉搜索树/第二期/在 BST 中搜索一个数.java: -------------------------------------------------------------------------------- 1 | public class Solution { 2 | boolean isInBST(TreeNode root, int target) { 3 | if (root == null) 4 | return false; 5 | if (root.val == target) 6 | return true; 7 | if (root.val < target) 8 | return isInBST(root.right, target); 9 | if (root.val > target) 10 | return isInBST(root.left, target); 11 | // root 该做的事做完了,顺带把框架也完成了,妙 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉树集锦/104.二叉树最大深度.java: -------------------------------------------------------------------------------- 1 | 2 | class Solution { 3 | private int res; 4 | private int depth; 5 | 6 | public int maxDepth(TreeNode root) { 7 | if (root == null) { 8 | return 0; 9 | } 10 | traverse(root); 11 | return res; 12 | } 13 | 14 | private void traverse(TreeNode root) { 15 | if (root == null) { 16 | res = Math.max(res, depth); 17 | return; 18 | } 19 | depth++; 20 | traverse(root.left); 21 | traverse(root.right); 22 | depth--; 23 | } 24 | } -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉树集锦/124求二叉树中的最大路径和.js: -------------------------------------------------------------------------------- 1 | const maxPathSum = (root) => { 2 | let maxSum = Number.MIN_SAFE_INTEGER; // 最大路径和 3 | const dfs = (root) => { 4 | if (root == null) return 0; // 遍历到null节点,返回0; 5 | 6 | const left = Math.max(0, dfs(root.left)); // 左子树提供的最大收益 7 | const right = Math.max(0, dfs(root.right)); // 右子树提供的最大收益 8 | maxSum=Math.max(maxSum,left+right+root.val); 9 | 10 | return Math.max(left,right)+root.val //返回节点贡献的最大值 11 | }; 12 | 13 | dfs(root); // 递归的入口 14 | return maxSum; 15 | }; -------------------------------------------------------------------------------- /1.算法框架_labuladong/3.二叉树集锦/TreeNode.java: -------------------------------------------------------------------------------- 1 | public class TreeNode { 2 | int val; 3 | TreeNode left; 4 | TreeNode right; 5 | 6 | TreeNode() { 7 | } 8 | 9 | TreeNode(int val) { 10 | this.val = val; 11 | } 12 | 13 | TreeNode(int val, TreeNode left, TreeNode right) { 14 | this.val = val; 15 | this.left = left; 16 | this.right = right; 17 | } 18 | } -------------------------------------------------------------------------------- /1.算法框架_labuladong/New Topics_after 2021-08/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/1.算法框架_labuladong/New Topics_after 2021-08/.gitkeep -------------------------------------------------------------------------------- /1.算法框架_labuladong/New Topics_after 2021-08/待完成/139. 单词拆分.py: -------------------------------------------------------------------------------- 1 | from typing import List 2 | 3 | 4 | class Solution: 5 | 6 | def wordBreak(self, s: str, wordDict: List[str]) -> bool: 7 | # 完全背包问题,每个元素可以选多次 8 | n = len(s) 9 | dp = [False] * (n + 1) 10 | dp[0] = True 11 | for i in range(n): 12 | for j in range(i + 1, n + 1): 13 | if dp[i] and s[i:j] in wordDict: 14 | dp[j] = True 15 | return dp[-1] 16 | 17 | 18 | # O(N^2) -------------------------------------------------------------------------------- /1.算法框架_labuladong/New Topics_after 2021-08/待完成/58.最后一个单词的长度.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def lengthOfLastWord(self, s: str) -> int: 3 | n = len(s) 4 | ans = 0 5 | # 倒序遍历 6 | for i in range(n - 1, -1, -1): 7 | if s[i] != " ": 8 | ans += 1 9 | else: 10 | if ans: 11 | return ans 12 | return ans 13 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/New Topics_after 2021-08/待完成/71.简化路径.py: -------------------------------------------------------------------------------- 1 | class Solution: 2 | def simplifyPath(self, path: str) -> str: 3 | names = path.split("/") 4 | stack = list() 5 | for name in names: 6 | if name == "..": 7 | if stack: 8 | stack.pop() 9 | elif name and name != ".": 10 | stack.append(name) 11 | return "/" + "/".join(stack) 12 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/New Topics_after 2021-08/最大频率栈/test.ts: -------------------------------------------------------------------------------- 1 | namespace LeetCode895Test { 2 | export const test = () => { 3 | const m = new Map() 4 | m.set(1, [1, 2, 3]) 5 | m.get(1).push(1000) 6 | console.log(m.get(1)) 7 | } 8 | } 9 | 10 | LeetCode895Test.test() 11 | -------------------------------------------------------------------------------- /1.算法框架_labuladong/New Topics_after 2021-08/链表/237. 删除链表中的节点.ts: -------------------------------------------------------------------------------- 1 | namespace Leetcode237 { 2 | function deleteNode(node: ListNode | null): void { 3 | if (node) { 4 | node.val = node.next!.val 5 | node.next = node.next!.next 6 | } 7 | } 8 | 9 | class ListNode { 10 | val: number 11 | next: ListNode | null 12 | constructor(val?: number, next?: ListNode | null) { 13 | this.val = val === undefined ? 0 : val 14 | this.next = next === undefined ? null : next 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /2.剑指Offer/0 test.js: -------------------------------------------------------------------------------- 1 | // const run=()=>{ 2 | // for(let i=0;i<=10;++i){ 3 | // console.log(i); 4 | // } 5 | // } 6 | // run() 7 | 8 | let window={ 9 | 1: 234, 10 | 2:33333 11 | } 12 | console.log(window[1]); -------------------------------------------------------------------------------- /2.剑指Offer/DFS_深度遍历_√/36. 二叉搜索树与双向链表.js: -------------------------------------------------------------------------------- 1 | // 36. 二叉搜索树与双向链表 2 | /* 3 | 输入一棵二叉搜索树,将该二叉搜索树转换成一个排序的循环双向链表。 4 | 要求不能创建任何新的节点,只能调整树中节点指针的指向。 5 | */ 6 | // 中序遍历, 左-中-右 由小到大排序 7 | function treeToDoublyList(root) { 8 | let pre, head 9 | if (root == null) return null 10 | const dfs = (cur) => { 11 | if (cur == null) return 12 | dfs(cur.left) 13 | if (pre != null) pre.right = cur 14 | else head = cur //pre==null时,说明正在表头 15 | cur.left = pre 16 | pre = cur 17 | dfs(cur.right) 18 | } 19 | dfs(root) 20 | // 头部前驱指向尾部,尾部后继为头部 21 | head.left = pre 22 | pre.right = head 23 | return head 24 | } 25 | -------------------------------------------------------------------------------- /2.剑指Offer/DFS_深度遍历_√/54. 二叉搜索树的第 k 大节点.js: -------------------------------------------------------------------------------- 1 | // 54. 二叉搜索树的第 k 大节点 2 | /* 3 | 给定一棵二叉搜索树,请找出其中第k大的节点。 4 | 5 | ! 树的深度遍历 6 | 将中序遍历按照右、中、左遍历即可---即可得到由大到小的数组 7 | 8 | *时间复杂度 O(n),空间复杂度:O(1) 9 | */ 10 | // ! 11 | 12 | var kthLargest = function (root, k) { 13 | let count = 1 14 | let res 15 | const helper = (root) => { 16 | if (!root) return 17 | helper(root.left) 18 | if (count === k) return (res = root.val) 19 | else count++ 20 | helper(root.right) 21 | } 22 | helper(root) 23 | return res 24 | } 25 | -------------------------------------------------------------------------------- /2.剑指Offer/DFS_深度遍历_√/55 - I. 二叉树的深度.js: -------------------------------------------------------------------------------- 1 | // 55 - I. 二叉树的深度 2 | /* 3 | 输入一棵二叉树的根节点,求该树的深度。从根节点到叶节点依次经过的节点 4 | (含根、叶节点)形成树的一条路径,最长路径的长度为树的深度。 5 | 6 | 例如: 7 | 8 | 给定二叉树 [3,9,20,null,null,15,7], 9 | 10 | 3 11 | / \ 12 | 9 20 13 | / \7离开济南的你 14 | 15 7 15 | 返回它的最大深度 3 16 | */ 17 | // ! 树的深度遍历 18 | 19 | var maxDepth = function (root) { 20 | if (root == null) { 21 | return 0 22 | } 23 | return Math.max(maxDepth(root.left) + 1, maxDepth(root.right) + 1) 24 | } 25 | -------------------------------------------------------------------------------- /2.剑指Offer/二叉树_√/68 - II. 二叉树的最近公共祖先.js: -------------------------------------------------------------------------------- 1 | // 68 - II. 二叉树的最近公共祖先 2 | const lowestCommonAncestor = (root, p, q) => { 3 | if (root == null || root == p || root == q) { 4 | return root 5 | } 6 | left = lowestCommonAncestor(root.left, p, q) 7 | right = lowestCommonAncestor(root.right, p, q) 8 | if (!left && !right) { 9 | return null 10 | } else if (!left && right) { 11 | return right 12 | } else if (left && !right) { 13 | return left 14 | } else { 15 | // 左右均不为空,则root就是left,right的root 16 | return root 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /2.剑指Offer/位运算_√/15二进制中1的个数.js: -------------------------------------------------------------------------------- 1 | // 15二进制中1的个数 2 | /* 3 | 请实现一个函数,输入一个整数,输出该数二进制表示中 1 的个数。 4 | 例如,把 9 表示成二进制是 1001,有 2 位是 1。因此,如果输入 9,则该函数输出 2。 5 | */ 6 | 7 | var hammingWeight = function (n) { 8 | const str = n.toString(2) 9 | let count = 0 10 | // 或者str.charAt(i) 11 | for (let item of str) { 12 | if (item === '1') { 13 | count += 1 14 | } 15 | continue 16 | } 17 | return count 18 | } 19 | console.log(hammingWeight(0000111001110111)) 20 | -------------------------------------------------------------------------------- /2.剑指Offer/位运算_√/65. 不用加减乘除做加法.js: -------------------------------------------------------------------------------- 1 | // 65. 不用加减乘除做加法 2 | const add = (a, b) => { 3 | while (b != 0) { 4 | let carry = (a & b) << 1 5 | let n = a ^ b 6 | a = n 7 | b = carry 8 | } 9 | return a 10 | } 11 | -------------------------------------------------------------------------------- /2.剑指Offer/动态规划_√/10 青蛙跳台阶.js: -------------------------------------------------------------------------------- 1 | // 10 青蛙跳台阶 2 | // 一只青蛙一次可以跳上1级台阶,也可以跳上2级台阶。求该青蛙跳上一个 n 级的台阶总共有多少种跳法。 3 | // !动态规划思想 --由底向上通过迭代解决问题 4 | function numWays(n) { 5 | let over = 1000000007 6 | const dp = new Array(n).fill(n) 7 | dp[0] = 1 8 | dp[1] = 1 9 | dp[2] = 2 10 | for (let i = 3; i <= n; i++) { 11 | dp[i] = (dp[i - 2] + dp[i - 1]) % over 12 | } 13 | return dp[n] 14 | } 15 | 16 | //! 也是斐波那契数列变形 17 | var numWays = function (n) { 18 | let n1 = 1, 19 | n2 = 1, 20 | sum 21 | for (let i = 0; i < n; i++) { 22 | sum = (n1 + n2) % 1000000007 23 | n1 = n2 24 | n2 = sum 25 | } 26 | return n1 27 | } 28 | -------------------------------------------------------------------------------- /2.剑指Offer/动态规划_√/14剪绳子2_大数取模.js: -------------------------------------------------------------------------------- 1 | // 14剪绳子2_大数取模 2 | var cuttingRope = function (n) { 3 | let arr = [0, 0, 1, 2, 4] 4 | if (n < 5) return arr[n] 5 | const max = 1e9 + 7 6 | let res = 1 7 | while (n >= 5) { 8 | res = (res % max) * 3 9 | n = n - 3 10 | } 11 | return (res * n) % max 12 | } 13 | -------------------------------------------------------------------------------- /2.剑指Offer/动态规划_√/test.js: -------------------------------------------------------------------------------- 1 | const a=('1'||0) 2 | // 只要比0大,便会输出 3 | console.log(a); 4 | 5 | console.log(['1','2','100'].reduce((pre,cur)=>Number(pre)+Number(cur))); 6 | 7 | const getSum=(nums)=>{ 8 | let res=0; 9 | while(nums){ 10 | res+=(nums%10); 11 | nums=Math.floor(nums/10); 12 | } 13 | } 14 | 15 | -------------------------------------------------------------------------------- /2.剑指Offer/哈希表_√/2二维数组中的查找.js: -------------------------------------------------------------------------------- 1 | // 2二维数组中的查找 2 | const findNumberIn2DArray = (matrix, target) => { 3 | let flag = false 4 | for (let arr of matrix) { 5 | if (flag === true) break 6 | // 用some减少遍历负担,找到立刻退出 7 | arr.some((item, index, self) => { 8 | if (target === item) { 9 | flag = true 10 | return true 11 | } else { 12 | return false 13 | } 14 | }) 15 | } 16 | return flag 17 | } 18 | 19 | const m1 = [ 20 | [1, 4, 7, 11, 15], 21 | [2, 5, 8, 12, 19], 22 | [3, 6, 9, 16, 22], 23 | [10, 13, 14, 17, 24], 24 | [18, 21, 23, 26, 30], 25 | ] 26 | 27 | console.log(findNumberIn2DArray(m1, 20)) 28 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/11旋转数组的最小数字.js: -------------------------------------------------------------------------------- 1 | // 11旋转数组的最小数字 2 | let temp = [3, 4, 5, 1, 2] 3 | 4 | const minArray = (arr) => { 5 | const min = Math.min(...arr) 6 | let arr1 = arr 7 | arr1.every((item, index, self) => { 8 | if (arr1[0] === min) return false 9 | if (arr1[0] > min) { 10 | arr1.push(arr1.shift()) 11 | return true 12 | } 13 | }) 14 | return arr1[0] 15 | } 16 | 17 | console.log(minArray(temp)) 18 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/17打印从1到最大的n位数.js: -------------------------------------------------------------------------------- 1 | // 17打印从1到最大的n位数 2 | /* 3 | 4 | 输入数字 n,按顺序打印出从 1 到最大的 n 位十进制数。比如输入 3, 5 | 则打印出 1、2、3 一直到最大的 3 位数 999。 6 | */ 7 | var printNumbers = function (n) { 8 | let arr = [], 9 | max = '' 10 | while (n > 0) { 11 | max += '9' 12 | n-- 13 | } 14 | maxVal = Number(max) 15 | for (let i = 1; i <= maxVal; i++) { 16 | arr.push(i) 17 | } 18 | return arr 19 | } 20 | console.log(printNumbers(2)) 21 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/20. 表示数值的字符串.js: -------------------------------------------------------------------------------- 1 | // 20. 表示数值的字符串 2 | /* 3 | 请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。 4 | 例如,字符串"+100"、"5e2"、"-123"、"3.1416"、"-1E-16"、"0123" 5 | 都表示数值, 6 | 但"12e"、"1a3.14"、"1.2.3"、"+-5"及"12e+5.4"都不是。 7 | */ 8 | // !注意空格特殊情况 Number("")结果是0 9 | var isNumber = function (s) { 10 | if (s.trim() === '') return false 11 | return isNaN(s.trim()) ? false : true 12 | } 13 | console.log(isNumber('1a3.14')) 14 | console.log(isNumber('-1E-16')) 15 | console.log(isNumber(' ')) 16 | console.log(isNaN('')) //是一个数字 17 | console.log(Number('')) // 0 18 | console.log(isNaN(' ')) // 是一个数字 19 | console.log(Number(' ')) // 0 20 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/58 - II. 左旋转字符串.js: -------------------------------------------------------------------------------- 1 | // 58 - II. 左旋转字符串 2 | /* 3 | 字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部。 4 | 请定义一个函数实现字符串左旋转操作的功能。比如,输入字符串"abcdefg"和数字2, 5 | 该函数将返回左旋转两位得到的结果"cdefgab"。 6 | 7 | 输入: s = "abcdefg", k = 2 8 | 输出: "cdefgab" 9 | 10 | */ 11 | const s = 'abcdefg', 12 | k = 2 13 | 14 | var reverseLeftWords = function (s, n) { 15 | let res = '' 16 | for (let i = n; i < s.length; i++) { 17 | res += s[i] 18 | } 19 | for (let i = 0; i < n; i++) { 20 | res += s[i] 21 | } 22 | return res 23 | } 24 | console.log(reverseLeftWords(s, k)) 25 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/5替换空格.js: -------------------------------------------------------------------------------- 1 | // 5替换空格 2 | // 将字符串s中的空格换为%20 3 | /* 4 | 输入:s = "We are happy." 5 | 输出:"We%20are%20happy." 6 | */ 7 | const str = 'We%20are%20happy.' 8 | const replaceSpace = (s) => { 9 | let res = s.replace(/ /gi, '%20') 10 | return res 11 | } 12 | console.log(replaceSpace(str)) 13 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/61. 扑克牌中的顺子.js: -------------------------------------------------------------------------------- 1 | // 61. 扑克牌中的顺子 2 | // 从扑克牌中随机抽5张牌,判断是不是一个顺子, 3 | // 即这5张牌是不是连续的。2~10为数字本身, 4 | // A为1,J为11,Q为12,K为13,而大、小王为 0 ,可以看成任意数字。 5 | // A 不能视为 14。 6 | 7 | // ! 利用Set的去重 [1,2,3,0,0], [1,3,9,0,0] 8 | const isStraight = (nums) => { 9 | let set = new Set() 10 | let max = 1, 11 | min = 14 12 | for (let n of nums) { 13 | if (n !== 0) { 14 | if (set.has(n)) return false 15 | set.add(n) 16 | max = Math.max(max, n) 17 | min = Math.min(min, n) 18 | } 19 | } 20 | return max - min < 5 21 | } 22 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/67. 正则_把字符串转换成整数.js: -------------------------------------------------------------------------------- 1 | // 67. 正则_把字符串转换成整数 2 | var strToInt = function (str) { 3 | let res = str.match(/^\s*[+-]?\d+/) 4 | if (!res) return 0 5 | // 符号部分:[+-], \s空格开头 6 | res = str.match(/^\s*[+-]?\d+/)[0].trim() 7 | if (res >= Math.pow(2, 31)) { 8 | return Math.pow(2, 31) - 1 9 | } else if (res <= Math.pow(-2, 31)) { 10 | return Math.pow(-2, 31) 11 | } else { 12 | return res 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /2.剑指Offer/数组+字符串_√/test.js: -------------------------------------------------------------------------------- 1 | const test=()=>{ 2 | let a=0,b=10; 3 | while(true){ 4 | // ++a 5 | console.log(a); 6 | if(a==0) break; 7 | console.log("??????") 8 | break; 9 | } 10 | } 11 | test() -------------------------------------------------------------------------------- /2.剑指Offer/递归_√/64. 求1+2+…+n .js: -------------------------------------------------------------------------------- 1 | // 64. 求1+2+…+n 2 | /* 3 | 求 1+2+...+n ,要求不能使用乘除法、 4 | for、while、if、else、switch、case等关键字及条件判断语句(A?B:C)。 5 | 6 | */ 7 | //! 递归,&&逻辑符短路 8 | var sumNums = function (n) { 9 | n > 0 && sumNums(n - 1) + n 10 | return n 11 | } 12 | -------------------------------------------------------------------------------- /2.剑指Offer/链表_√/18删除链表的节点.js: -------------------------------------------------------------------------------- 1 | // 18删除链表的节点 2 | /* 3 | 给定单向链表的头指针和一个要删除的节点的值,定义一个函数删除该节点。 4 | 返回删除后的链表的所有节点值。 5 | */ 6 | // arr数组,val 7 | // [4,5,1,9] 8 | // 使用哨兵节点,循环找到节点,进行删除 9 | 10 | var deleteNode = function (head, val) { 11 | let pre = new ListNode(-1) // 哨兵节点 12 | pre.next = head 13 | 14 | let node = pre 15 | while (node.next) { 16 | if (node.next.val === val) { 17 | node.next = node.next.next 18 | break 19 | } 20 | node = node.next 21 | } 22 | return pre.next 23 | } 24 | -------------------------------------------------------------------------------- /2.剑指Offer/链表_√/25合并两个排序的链表.js: -------------------------------------------------------------------------------- 1 | // 25合并两个排序的链表 2 | /* 3 | 输入两个递增排序的链表,合并这两个链表并使新链表中的节点仍然是递增排序的。 4 | 5 | 示例1: 6 | 输入:1->2->4, 2->3->4 7 | 输出:1->2->2->3->4->4 8 | 9 | 10 | 1->2->5 0->3->4 11 | */ 12 | /* 13 | ! 递归 14 | */ 15 | // 会每次递归先将值return出来 16 | var mergeTwoLists = function (l1, l2) { 17 | if (l1 === null) return l2 18 | if (l2 === null) return l1 19 | if (l1.val < l2.val) { 20 | l1.next = mergeTwoLists(l1.next, l2) 21 | return l1 22 | } else { 23 | l2.next = mergeTwoLists(l1, l2.next) 24 | return l2 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /3.Data Structure/Node中Buffer对象.js: -------------------------------------------------------------------------------- 1 | // Buffer对象是Node处理二进制数据的一个接口。 2 | // 它是Node原生提供的全局对象,可以直接使用,不需要require('buffer')。 3 | 4 | // new Buffer() 是node.js中的对象 5 | /* 6 | Blob: 前端的一个专门用于支持文件操作的二进制对象 7 | 8 | ArrayBuffer:前端的一个通用的二进制缓冲区,类似数组,但在API和特性上却有诸多不同 9 | 10 | Buffer:Node.js提供的一个二进制缓冲区,常用来处理I/O操作 11 | */ 12 | // const encode1=new Buffer.from("http://tinyurl.com/").toString('base64') //aHR0cDovL3Rpbnl1cmwuY29tLw== 13 | // const encode1=new Buffer.from("http://tinyurl.com/","base64").toString() // ��i��b�+���& 乱码 14 | // console.log(encode1); -------------------------------------------------------------------------------- /3.Data Structure/temp.js: -------------------------------------------------------------------------------- 1 | let myMap = new Map().set(true, 7).set({foo: 3}, ['abc']); 2 | let res=[...myMap] 3 | console.log(res); 4 | 5 | 6 | let obj={'a':'1', 'b':'2','c':'3'} 7 | console.log(Object.values(obj)) -------------------------------------------------------------------------------- /4.Basic Challenge/1 反转字符串.js: -------------------------------------------------------------------------------- 1 | const str='Hello World!'; 2 | Reverse=(data)=>{ 3 | return data.split('').reverse().join(''); 4 | } 5 | const res=Reverse(str); 6 | console.log(res); -------------------------------------------------------------------------------- /4.Basic Challenge/10排序_选择排序.js: -------------------------------------------------------------------------------- 1 | // > 每一趟从待排序的数据元素中选择最小(或最大)的一个元素作为首元素,直到所有元素排完为止。 2 | 3 | function selectSort(arr) { 4 | for (let i = 0; i < arr.length; i++) { 5 | let min = Math.min(...arr.slice(i)) 6 | let index = arr.indexOf(min) 7 | ;[arr[i], arr[index]] = [arr[index], arr[i]] 8 | } 9 | return arr 10 | } 11 | 12 | // const findMin=Math.min.apply(null,arr) 13 | let list = [10, 1, 3, 4, 100, -20, 30, 7] 14 | let list2 = [-11, 200, 20, 30, 10, 2, 3, 4, -10, -200] 15 | // console.log(swapSort(list)) 16 | 17 | console.log(selectSort(list2)) 18 | -------------------------------------------------------------------------------- /4.Basic Challenge/11排序_插入排序.js: -------------------------------------------------------------------------------- 1 | function insertSort(arr) { 2 | let len = arr.length 3 | if (!Array.isArray(arr) || len <= 1) return 4 | for (let i = 1; i < len; i++) { 5 | let j = i - 1 6 | // 之前的值大? 7 | if (arr[j] > arr[i]) { 8 | let temp = arr[i] 9 | while (j >= 0 && temp < arr[j]) { 10 | arr[j + 1] = arr[j] 11 | j-- 12 | } 13 | arr[j + 1] = temp 14 | } 15 | } 16 | return arr 17 | } 18 | -------------------------------------------------------------------------------- /4.Basic Challenge/16递归的缺点以及解决方案.js: -------------------------------------------------------------------------------- 1 | /* 2 | !!堆栈溢出 3 | 4 | 1)递归的本质就是重复调用本身的过程,本身是什么? 5 | 2)函数中变量是存储到系统中的栈中的,栈数据结构的特点就是先进后出,后进先出。 6 | 3)递归的过程,函数中的变量一直不断的压栈,由于我们系统栈或虚拟机栈空间是非常小的,当栈压满之后,再压时,就会导致堆栈溢出。 7 | 8 | 9 | 10 | *解决办法1 设置递归深度 11 | 简单的理解就是,如果递归超过我们设置的深度,我们就退出,不再递归下去 12 | depth++; if(depth>1000) throw 'error' 13 | 14 | * 有些递归问题中,存在重复计算问题,比如求斐波那契数列,我们会发现有很多重复递归计算的值,重复计算会导致程序的时间复杂度很高,而且是指数级别的,导致我们的程序效率低下。 15 | 16 | * 解决办法 使用散列表Map进行保存 17 | 我们把已经计算过的值保存起来,每次递归计算之前先检查一下保存的数据有没有该数据。 18 | 如果有,我们拿出来直接用。如果没有,我们计算出来保存起来。一般我们用散列表来保存。 19 | (所谓的散列表就是键值对的形式,如 map ) 20 | 21 | */ -------------------------------------------------------------------------------- /4.Basic Challenge/17贪心算法_人民币支付.js: -------------------------------------------------------------------------------- 1 | //coins : 面值 2 | //amount: 总价 3 | function minCoinChange(coins, amount){ 4 | let change = [], total = 0; 5 | for(let i = coins.length; i >= 0; i--){ 6 | let coin = coins[i] 7 | while(total + coin <= amount){ 8 | change.push(coin); 9 | total += coin 10 | } 11 | } 12 | return change; 13 | } 14 | 15 | //调用 16 | console.log(minCoinChange([1,2,5,10,20,50,100],628)) -------------------------------------------------------------------------------- /4.Basic Challenge/1_数组拆分.js: -------------------------------------------------------------------------------- 1 | //数组排序 2 | //最大总和 3 | var arrayPairSum = function(num){ 4 | let sum = 0; 5 | //数组排序 6 | num.sort((a,b) => {return b - a;}); 7 | for(let i = 1; i < num.length; i = i + 2){ 8 | sum += num[i] 9 | } 10 | return sum 11 | } 12 | 13 | //调用 14 | let arr = [1,4,3,-100,-1,3,-10,200,2,5,6,7,8,9] 15 | console.log(arrayPairSum(arr)) //4 16 | 17 | // sort排序 18 | const Sort=(arr)=>{ 19 | return arr.sort((a,b)=>{ return b-a}) 20 | } 21 | console.log(Sort(arr)); 22 | -------------------------------------------------------------------------------- /4.Basic Challenge/21_单词是否是回文.js: -------------------------------------------------------------------------------- 1 | //步骤 2 | // 回文----正反都一样 3 | //1.for遍历当前字符串 4 | //2.判断前后比较是否相等 5 | function palindRome(str){ 6 | var len = str.length; 7 | let res=true 8 | //1.for遍历当前字符串 9 | for(var i = 0; i < len; i++){ 10 | //abcba 11 | //2.判断前后比较是否相等 12 | if(str.charAt(i) === str.charAt(len-1-i)){ 13 | continue 14 | }else{ 15 | res=false; 16 | break; 17 | } 18 | } 19 | return res 20 | } 21 | 22 | //调用 23 | let str = "abccccc" 24 | console.log(palindRome(str)) -------------------------------------------------------------------------------- /4.Basic Challenge/23_随机生成指定长度的字符串.js: -------------------------------------------------------------------------------- 1 | const createCode=(len)=>{ 2 | //创建数组 数字和字母 3 | var arr = ["a","b","c","d","e","f","g","A","B","C","D","E","F","G","1","2","3","4","5","6"]; 4 | var code = ""; 5 | 6 | //随机生成数字,从数组当中取len元素 7 | for(var i = 0; i < len; i++){ 8 | //生成随机下标 [0,1] 9 | var index = parseInt(Math.random() * arr.length); 10 | code += arr[index] 11 | } 12 | return code; 13 | } 14 | //调用 15 | console.log(createCode(4)) -------------------------------------------------------------------------------- /4.Basic Challenge/25url加密解密.js: -------------------------------------------------------------------------------- 1 | // btoa加密和atob解密只能用在html中,node不支持 2 | 3 | 4 | // new Buffer() 是node.js中的对象 5 | const encode = function(longUrl) { 6 | return 'http://tinyurl.com/' + new Buffer.from(longUrl).toString('base64') 7 | }; 8 | 9 | const decode = function(shortUrl) { 10 | return new Buffer.from((shortUrl.split('http://tinyurl.com/')[1]), 'base64').toString() 11 | }; 12 | 13 | const url='https://leetcode.com/problems/design-tinyurl'; 14 | console.log(`加密后${encode(url)}`); 15 | console.log(`解密后${decode(encode(url))}`); -------------------------------------------------------------------------------- /4.Basic Challenge/27阶乘.js: -------------------------------------------------------------------------------- 1 | const factorial=(n)=>{ 2 | if(n===1 || n===0) return 1 3 | return n*factorial(n-1) 4 | } 5 | 6 | console.log(factorial(4)); //24 7 | console.log(factorial(5)); //120 -------------------------------------------------------------------------------- /4.Basic Challenge/5 求数组min之和.js: -------------------------------------------------------------------------------- 1 | const list=[1,2,3,4,5,6,7,8,1,100]; 2 | // const list=[1,2,3,4]; 3 | let temp=[]; 4 | let temp2=[]; 5 | let num=0 6 | const Min=(arr)=>{ 7 | return arr.sort((a,b)=>{ 8 | return a-b 9 | })[0] 10 | } 11 | // console.log(Min([3,4,1])); 12 | const Sum=(list)=>{ 13 | for(let i=0;i{ 20 | num+=item 21 | }) 22 | return num 23 | } 24 | 25 | console.log(Sum(list)); -------------------------------------------------------------------------------- /4.Basic Challenge/9排序_冒泡排序.js: -------------------------------------------------------------------------------- 1 | function bubbleSort(arr) { 2 | for (let i = 1; i < arr.length; i++) { 3 | for (let j = i; j > 0; j--) { 4 | if (arr[j - 1] > arr[j]) { 5 | ;[arr[j - 1], arr[j]] = [arr[j], arr[j - 1]] 6 | } 7 | } 8 | } 9 | return arr 10 | } 11 | let list = [1, 2, 3, 100, 99, -1, 3, 10, -200] 12 | console.log(bubbleSort(list)) 13 | -------------------------------------------------------------------------------- /5.Daily Challenge/0_复杂度.js: -------------------------------------------------------------------------------- 1 | // 0_复杂度 2 | /* 3 | log是以2为底的 4 | 😕 5 | O(N^N) 6 | O(N!) 7 | O(2N) 8 | O(N^3) 9 | O(N^2) 动态规划,冒泡,插入,选择,交换 10 | O(N logN) 一般贪心, 快速(不稳定),希尔(不稳定),归并(稳定为N logN), 11 | O(N) 桶排序, 12 | O(logN) 二分法 13 | O(1) 14 | */ 15 | -------------------------------------------------------------------------------- /5.Daily Challenge/0_技巧总结.js: -------------------------------------------------------------------------------- 1 | // 0_技巧总结 2 | for (var a of s) h[a] = (h[a] || 0) + 1 3 | for (var a in h) h[a] < k && n.push(a) 4 | for (let i of s) { 5 | record[i] = (record[i] || 0) + 1 6 | } 7 | 8 | // return A= C? A++ : B===C && C++ 9 | 10 | h.set(s[i], h.has(s[i]) ? h.get(s[i]) + 1 : 1) 11 | -------------------------------------------------------------------------------- /5.Daily Challenge/0_最大公约数_最小公倍数.js: -------------------------------------------------------------------------------- 1 | // 0_最大公约数_最小公倍数 2 | // 最大公约数 3 | function gcd(a, b) { 4 | if (b == 0) { 5 | return a 6 | } 7 | var r = a % b 8 | return gcd(b, r) 9 | } 10 | // 最小公倍数 11 | function scm(a, b) { 12 | return (a * b) / gcd(a, b) 13 | } 14 | -------------------------------------------------------------------------------- /5.Daily Challenge/1010. 总持续时间可被 60 整除的歌曲.js: -------------------------------------------------------------------------------- 1 | // 1010. 总持续时间可被 60 整除的歌曲 2 | 3 | const numPairsDivisibleBy60 = (time) => { 4 | let res = 0 5 | let seconds = new Array(60).fill(0) 6 | for (let t of time) { 7 | let i = 60 - (t % 60) 8 | res += seconds[i == 60 ? 0 : i] 9 | seconds[t % 60] += 1 10 | } 11 | return res 12 | } 13 | 14 | // 例如 2, i=58 , s[2]++; 15 | -------------------------------------------------------------------------------- /5.Daily Challenge/1015. 可被 K 整除的最小整数.js: -------------------------------------------------------------------------------- 1 | // 1015. 可被 K 整除的最小整数 2 | function smallestRepunitDivByK(K) { 3 | let seen = new Array(K).fill(false) 4 | let n = 0 5 | let c = 0 6 | while (!seen[n]) { 7 | seen[n] = true 8 | n = (10 * n + 1) % K 9 | ++c 10 | } 11 | return n == 0 ? c : -1 12 | } 13 | 14 | function smallestRepunitDivByK(K) { 15 | if (K % 2 == 0 || K % 5 == 0) { 16 | return -1 17 | } 18 | let temp = 1 19 | let len = 1 20 | while (temp % K != 0) { 21 | temp = temp % K 22 | temp = temp * 10 + 1 23 | len++ 24 | } 25 | return len 26 | } 27 | -------------------------------------------------------------------------------- /5.Daily Challenge/1026. 节点与其祖先之间的最大差值.js: -------------------------------------------------------------------------------- 1 | // 1026. 节点与其祖先之间的最大差值 2 | var maxAncestorDiff = function (root) { 3 | // BASE 4 | if (!root) return 0 5 | let res = Number.MIN_SAFE_INTEGER 6 | const dfs = (root, max, min) => { 7 | if (!root) return 8 | max = Math.max(root.val, max) 9 | min = Math.min(root.val, min) 10 | // 到达最深层节点 11 | if (!root.left && !root.right) { 12 | res = Math.max(res, Math.abs(max - min)) 13 | } 14 | dfs(root.left, max, min) 15 | dfs(root.right, max, min) 16 | } 17 | dfs(root, root.val, root.val) 18 | return res 19 | } 20 | -------------------------------------------------------------------------------- /5.Daily Challenge/104. 二叉树的最大深度.js: -------------------------------------------------------------------------------- 1 | // 104. 二叉树的最大深度 2 | var maxDepth = function (root) { 3 | if (!root) return 0 4 | return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1 5 | } 6 | -------------------------------------------------------------------------------- /5.Daily Challenge/1046. 最后一块石头的重量.js: -------------------------------------------------------------------------------- 1 | // 1046. 最后一块石头的重量 2 | /* 3 | 有一堆石头,每块石头的重量都是正整数。 4 | 5 | 每一回合,从中选出两块 最重的 石头,然后将它们一起粉碎。假设石头的重量分别为 x 和 y,且 x <= y。那么粉碎的可能结果如下: 6 | 7 | 如果 x == y,那么两块石头都会被完全粉碎; 8 | 如果 x != y,那么重量为 x 的石头将会完全粉碎,而重量为 y 的石头新重量为 y-x。 9 | 最后,最多只会剩下一块石头。返回此石头的重量。如果没有石头剩下,就返回 0。 10 | 11 | */ 12 | 13 | var lastStoneWeight = function (stones) { 14 | stones.sort((a, b) => a - b) 15 | if (stones.length > 1) { 16 | const d = stones.pop() - stones.pop() 17 | if (d) stones.push(d) 18 | return lastStoneWeight(stones) 19 | } 20 | return stones.length ? stones[0] : 0 21 | } 22 | -------------------------------------------------------------------------------- /5.Daily Challenge/1081. 不同字符的最小子序列.js: -------------------------------------------------------------------------------- 1 | // 和316 去除重复字母一模一样 2 | // 1081. 不同字符的最小子序列 3 | //! 使用单调栈解决 4 | const smallestSubsequence = function (s) { 5 | let stack = [] 6 | for (let i = 0; i < s.length; i++) { 7 | let char = s[i] 8 | if (stack.indexOf(char) > -1) continue 9 | while ( 10 | stack.length !== 0 && 11 | stack[stack.length - 1] > char && //stack最后一位大于当前字母 12 | s.indexOf(stack[stack.length - 1], i) > i //从s第i位开始查stack最后一位数字,确认还有的话才删除前面的字母 13 | ) { 14 | stack.pop() 15 | } 16 | stack.push(char) 17 | } 18 | return stack.join('') 19 | } 20 | -------------------------------------------------------------------------------- /5.Daily Challenge/110. 平衡二叉树.js: -------------------------------------------------------------------------------- 1 | /* 2 | 110. 平衡二叉树 3 | 给定一个二叉树,判断它是否是高度平衡的二叉树。 4 | 5 | 本题中,一棵高度平衡二叉树定义为: 6 | 7 | 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过 1 。 8 | 9 | */ 10 | 11 | // 自底向上 12 | const isBalanced = function (root) { 13 | return balanced(root) !== -1 14 | } 15 | const balanced = function (node) { 16 | if (!node) return 0 17 | const left = balanced(node.left) 18 | const right = balanced(node.right) 19 | if (left === -1 || right === -1 || Math.abs(left - right) > 1) { 20 | return -1 21 | } 22 | return Math.max(left, right) + 1 23 | } 24 | -------------------------------------------------------------------------------- /5.Daily Challenge/116. 填充每个节点的下一个右侧节点指针.js: -------------------------------------------------------------------------------- 1 | // 116. 填充每个节点的下一个右侧节点指针 2 | 3 | // 前提:完全二叉树 4 | function connect(root) { 5 | if (root == null) return null 6 | connectTwoNode(root.left, root.right) 7 | return root 8 | } 9 | 10 | // 定义:输入两个节点,将它俩连接起来 11 | function connectTwoNode(node1, node2) { 12 | if (node1 == null || node2 == null) { 13 | return 14 | } 15 | /**** 前序遍历位置 ****/ 16 | // 将传入的两个节点连接 17 | node1.next = node2 18 | 19 | // 连接相同父节点的两个子节点 20 | connectTwoNode(node1.left, node1.right) 21 | connectTwoNode(node2.left, node2.right) 22 | // 连接跨越父节点的两个子节点 23 | connectTwoNode(node1.right, node2.left) 24 | } 25 | -------------------------------------------------------------------------------- /5.Daily Challenge/117. 填充每个节点的下一个右侧节点指针 II.js: -------------------------------------------------------------------------------- 1 | // 117. 填充每个节点的下一个右侧节点指针 II 2 | var connect = function (root) { 3 | if (!root) return null 4 | let res = root 5 | let queue = [res] 6 | //层序遍历 7 | while (queue.length) { 8 | let len = queue.length 9 | let pre = null 10 | for (let i = 0; i < len; i++) { 11 | let node = queue.shift() 12 | node.left && queue.push(node.left) 13 | node.right && queue.push(node.right) 14 | //记录上一个节点,上一个节点指向当前节点 15 | if (pre) { 16 | pre.next = node 17 | } 18 | pre = node 19 | } 20 | } 21 | return res 22 | } 23 | -------------------------------------------------------------------------------- /5.Daily Challenge/118.杨辉三角.js: -------------------------------------------------------------------------------- 1 | //118. 杨辉三角 2 | // i>>>1 就是除2 3 | const generate = function (numRows) { 4 | let r = new Array(numRows) 5 | for (let i = 0; i < numRows; i++) { 6 | r[i] = new Array(i + 1).fill(1) 7 | for (let j = 1; j <= i / 2; j++) { 8 | r[i][j] = r[i][i - j] = r[i - 1][j - 1] + r[i - 1][j] 9 | } 10 | } 11 | return r 12 | } 13 | console.log(9 >>> 1) 14 | console.log(9 >>> 2) 15 | console.log(8 >>> 1) 16 | console.log(9 >>> 0) 17 | -------------------------------------------------------------------------------- /5.Daily Challenge/123. 买卖股票的最佳时机 III.js: -------------------------------------------------------------------------------- 1 | // 123. 买卖股票的最佳时机 III 2 | // 交易N次有(1)和无(0)股票的情况 3 | function maxProfit(prices) { 4 | let dp_i10 = 0, 5 | dp_i11 = Number.MIN_SAFE_INTEGER 6 | let dp_i20 = 0, 7 | dp_i21 = Number.MIN_SAFE_INTEGER 8 | for (let price of prices) { 9 | dp_i20 = Math.max(dp_i20, dp_i21 + price) //无 10 | dp_i21 = Math.max(dp_i21, dp_i10 - price) //有,先算第二次交易,否则dp_i10会影响次数,再加1 11 | dp_i10 = Math.max(dp_i10, dp_i11 + price) //无 12 | dp_i11 = Math.max(dp_i11, -price) //有 13 | } 14 | return dp_i20 15 | } 16 | -------------------------------------------------------------------------------- /5.Daily Challenge/1272. 删除区间.js: -------------------------------------------------------------------------------- 1 | // 1272. 删除区间 2 | function removeInterval(intervals, toBeRemoved) { 3 | let toL = toBeRemoved[0], toR = toBeRemoved[1]; 4 | let ans=[]; 5 | for (let i = 0; i < intervals.length; ++i) { 6 | let x = intervals[i][0], y = intervals[i][1]; 7 | if (y<=toL || x>=toR) { //不相交 8 | ans.push([x, y]); 9 | } 10 | else { 11 | // 相交 12 | if (toL > x) { 13 | ans.push([x, toL]); 14 | } 15 | if (toR < y) { 16 | ans.push([toR, y]); 17 | } 18 | } 19 | } 20 | return ans; 21 | } 22 | -------------------------------------------------------------------------------- /5.Daily Challenge/1356. 根据数字二进制下 1 的数目排序.js: -------------------------------------------------------------------------------- 1 | // 1356. 根据数字二进制下 1 的数目排序 2 | var sortByBits = function (arr) { 3 | const helper = (number) => { 4 | return number.toString(2).replace(/[^1]/g, '').length 5 | } 6 | console.log(helper(3)) 7 | //题目要求, 如果完全一致,则按照数值大小排序 8 | arr.sort((a, b) => a - b) 9 | arr.sort((a, b) => { 10 | return helper(a) - helper(b) 11 | }) 12 | return arr 13 | } 14 | 15 | const arr = [1024, 512, 256, 128, 64, 32, 16, 8, 4, 2, 1] 16 | console.log(sortByBits(arr)) 17 | -------------------------------------------------------------------------------- /5.Daily Challenge/137. 只出现一次的数字 II.js: -------------------------------------------------------------------------------- 1 | // 137. 只出现一次的数字 II 2 | const singleNumber = function (arr) { 3 | arr.sort((a, b) => a - b) 4 | for (let i = 0; i < arr.length; i += 3) { 5 | if (arr[i] != arr[i + 1]) return arr[i] 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /5.Daily Challenge/144. 二叉树的前序遍历.js: -------------------------------------------------------------------------------- 1 | // 144. 二叉树的前序遍历 2 | /* 3 | 输入: [1,null,2,3] 4 | 1 5 | \ 6 | 2 7 | / 8 | 3 9 | 10 | 输出: [1,2,3] 11 | 12 | */ 13 | var preorderTraversal = function (root) { 14 | if (!root) return [] 15 | const res = [] 16 | const helper = (root) => { 17 | if (!root) return 18 | res.push(root.val) 19 | helper(root.left) 20 | helper(root.right) 21 | return res 22 | } 23 | return helper(root) 24 | } 25 | -------------------------------------------------------------------------------- /5.Daily Challenge/1492. n 的第 k 个因子.js: -------------------------------------------------------------------------------- 1 | // 1492. n 的第 k 个因子 2 | function kthFactor(n, k) { 3 | let i = 0 4 | while (k > 0 && i <= n) { 5 | i++ 6 | if (n % i == 0) { 7 | k-- //个数减少 8 | } 9 | } 10 | if (i > n) { 11 | return -1 12 | } 13 | return i 14 | } 15 | -------------------------------------------------------------------------------- /5.Daily Challenge/204.计算质数.js: -------------------------------------------------------------------------------- 1 | // 质数,从2开始,所有是2倍数的全部都不是 2 | // 从3开始,所有是3倍数的全都不是 3 | // ..... 4 | // 204.计算质数 5 | const countPrimes = (n) => { 6 | let num = 0 7 | let map = new Array(n).fill(true) //假设全是质数 8 | for (let i = 2; i < n; i++) { 9 | if (map[i] === true) { 10 | num++ 11 | for (let j = i + i; j < n; j += i) { 12 | //比如2, 2的倍数就都是false了,从小到大 13 | map[j] = false 14 | } 15 | } 16 | } 17 | return num 18 | } 19 | -------------------------------------------------------------------------------- /5.Daily Challenge/217. 存在重复元素.ts: -------------------------------------------------------------------------------- 1 | // 217. 存在重复元素 2 | const containsDuplicate = function (nums: number[]) { 3 | return nums.length !== new Set(nums).size 4 | } 5 | -------------------------------------------------------------------------------- /5.Daily Challenge/242. 有效的字母异位词.js: -------------------------------------------------------------------------------- 1 | // 242. 有效的字母异位词 2 | var isAnagram = function (s, t) { 3 | return Array.from(s).sort().join('') === Array.from(t).sort().join('') 4 | } 5 | -------------------------------------------------------------------------------- /5.Daily Challenge/268. Missing Number.js: -------------------------------------------------------------------------------- 1 | var missingNumber = function(nums) { 2 | nums=nums.sort((a,b)=>a-b) ; 3 | console.log(nums); 4 | let len=nums.length; 5 | let pointer=0; 6 | for(let i=0;i boolean 2 | const solution = (isBadVersion: _version) => { 3 | return (n: number) => { 4 | let low = 0, 5 | high = n, 6 | res = n 7 | while (low <= high) { 8 | const mid = (low + high) >>> 1 9 | if (isBadVersion(mid)) { 10 | res = mid 11 | high = mid - 1 12 | } else { 13 | low = mid + 1 14 | } 15 | } 16 | return res 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /5.Daily Challenge/283.移动零.js: -------------------------------------------------------------------------------- 1 | // 283.移动零 2 | function moveZeroes(nums) { 3 | let i = 0 4 | for (let j = 0; j < nums.length; j++) { 5 | //只要不为0就往前挪 6 | if (nums[j] != 0) { 7 | //i指向的值和j指向的值交换 8 | ;[nums[i], nums[j]] = [nums[j], nums[i]] 9 | i++ 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /5.Daily Challenge/290. 单词规律.js: -------------------------------------------------------------------------------- 1 | // 290. 单词规律 2 | var wordPattern = function (pattern, s) { 3 | const a = s.split(' ') 4 | if (pattern.length !== a.length) return false 5 | const hp = new Map(), 6 | hs = new Map() 7 | for (let i = 0; i < a.length; i++) { 8 | let p = pattern[i], 9 | s = a[i] 10 | if (hp.has(p)) { 11 | if (hp.get(p) !== s) return false 12 | } else { 13 | hp.set(p, s) 14 | } 15 | if (hs.has(s)) { 16 | if (hs.get(s) !== p) return false 17 | } else { 18 | hs.set(s, p) 19 | } 20 | } 21 | return true 22 | } 23 | -------------------------------------------------------------------------------- /5.Daily Challenge/337. 打家劫舍 III.js: -------------------------------------------------------------------------------- 1 | // 337. 打家劫舍 III 2 | function rob(root) { 3 | const dp = (root) => { 4 | if (root == null) return [0, 0] 5 | let left = dp(root.left) 6 | let right = dp(root.right) 7 | // 抢,下两家就不能抢了 8 | let rob = root.val + left[0] + right[0] 9 | // 不抢,下家可抢可不抢,取决于收益大小 10 | let not_rob = Math.max(left[0], left[1]) + Math.max(right[0], right[1]) 11 | 12 | return [not_rob, rob] 13 | } 14 | let res = dp(root) 15 | return Math.max(res[0], res[1]) 16 | } 17 | -------------------------------------------------------------------------------- /5.Daily Challenge/369. 给单链表加一.js: -------------------------------------------------------------------------------- 1 | // 369. 给单链表加一 2 | // 例如 12399 +1 =12400 3 | function plusOne(head) { 4 | //1.双指针 5 | let fast = head 6 | let slow = new ListNode(0) 7 | slow.next = head 8 | 9 | //2.遍历链表 10 | while (fast != null) { 11 | if (fast.val != 9) { 12 | slow = fast 13 | } 14 | // 等于9则不动 15 | fast = fast.next 16 | } 17 | 18 | //3.末位加1 19 | slow.val += 1 20 | let cur = slow.next 21 | // 慢指针后面全部设为0 22 | while (cur != null) { 23 | cur.val = 0 24 | cur = cur.next 25 | } 26 | return slow.next == head ? slow : head 27 | } 28 | -------------------------------------------------------------------------------- /5.Daily Challenge/387. 字符串中的第一个唯一字符.js: -------------------------------------------------------------------------------- 1 | // 387. 字符串中的第一个唯一字符 2 | /* 3 | 给定一个字符串,找到它的第一个不重复的字符,并返回它的索引。如果不存在,则返回 -1。 4 | 5 | s = "leetcode" 6 | 返回 0 7 | 8 | s = "loveleetcode" 9 | 返回 2 10 | */ 11 | 12 | const firstUniqChar = function (s) { 13 | let h = new Map(), 14 | i = 0 15 | while (i < s.length) { 16 | h.set(s[i], h.has(s[i]) ? h.get(s[i]) + 1 : 1) 17 | i++ 18 | } 19 | let res = -1 20 | Array.from(h).some(([key, val], index) => { 21 | if (val === 1) { 22 | res = s.indexOf(key) 23 | return true 24 | } 25 | }) 26 | return res 27 | } 28 | -------------------------------------------------------------------------------- /5.Daily Challenge/389. 找不同.js: -------------------------------------------------------------------------------- 1 | // 389. 找不同 2 | /* 3 | 输入:s = "abcd", t = "abcde" 4 | 输出:"e" 5 | 解释:'e' 是那个被添加的字母。 6 | 7 | */ 8 | 9 | var findTheDifference = function (s, t) { 10 | const map = new Map() 11 | for (let i = 0; i < s.length; i++) { 12 | const val = map.get(s[i]) 13 | map.set(s[i], val === undefined ? 1 : val + 1) 14 | } 15 | for (let i = 0; i < t.length; i++) { 16 | const val = map.get(t[i]) 17 | if (val === 0 || val === undefined) { 18 | return t[i] 19 | } else { 20 | map.set(t[i], val - 1) 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /5.Daily Challenge/452. 用最少数量的箭引爆气球.js: -------------------------------------------------------------------------------- 1 | // 452. 用最少数量的箭引爆气球 2 | function findMinArrowShots(arr) { 3 | if (arr.length == 0) return 0 4 | arr.sort((a, b) => a[1] - b[1]) 5 | let end = arr[0][1] 6 | let count = 1 7 | for (let interval of arr) { 8 | let start = interval[0] 9 | if (start > end) { 10 | count++ 11 | // 下一个 12 | end = interval[1] 13 | } 14 | } 15 | return count 16 | } 17 | -------------------------------------------------------------------------------- /5.Daily Challenge/455. 分发饼干.js: -------------------------------------------------------------------------------- 1 | // 455. 分发饼干 2 | /* 3 | 输入: g = [1,2], s = [1,2,3] 4 | 输出: 2 5 | 解释: 6 | 你有两个孩子和三块小饼干,2个孩子的胃口值分别是1,2。 7 | 你拥有的饼干数量和尺寸都足以让所有孩子满足。 8 | 所以你应该输出2. 9 | */ 10 | 11 | const findContentChildren = function (g, s) { 12 | let i = 0, 13 | j = 0 14 | g.sort((a, b) => a - b) // 升序 15 | s.sort((a, b) => a - b) // 升序 16 | while (j < s.length) { 17 | if (s[j] >= g[i]) { 18 | if (i === g.length) break 19 | i++ 20 | } 21 | 22 | j++ 23 | } 24 | return i 25 | } 26 | -------------------------------------------------------------------------------- /5.Daily Challenge/48. 旋转图像.js: -------------------------------------------------------------------------------- 1 | /* 2 | 48. 旋转图像 3 | 首页将输入 4 | 5 | 1 2 3 6 | 4 5 6 7 | 7 8 9 8 | 9 | 通过交换matrix[i][j], matrix[j][i] 得到 10 | 11 | 1 4 7 12 | 2 5 8 13 | 3 6 9 14 | 15 | 最后将得到每组数组倒序排列即可 16 | 17 | 7 4 1 18 | 8 5 2 19 | 9 6 3 20 | */ 21 | 22 | const rotate = function (matrix) { 23 | let martrixLength = matrix.length 24 | for (let i = 0; i < martrixLength; i++) { 25 | for (let j = i; j < martrixLength; j++) { 26 | let temp = matrix[i][j] 27 | matrix[i][j] = matrix[j][i] 28 | matrix[j][i] = temp 29 | } 30 | } 31 | return matrix.map((item) => item.reverse()) 32 | } 33 | -------------------------------------------------------------------------------- /5.Daily Challenge/49. 字母异位词分组.js: -------------------------------------------------------------------------------- 1 | /* 2 | 49. 字母异位词分组 3 | 给定一个字符串数组,将字母异位词组合在一起。字母异位词指字母相同,但排列不同的字符串。 4 | 输入: ["eat", "tea", "tan", "ate", "nat", "bat"] 5 | 输出: 6 | [ 7 | ["ate","eat","tea"], 8 | ["nat","tan"], 9 | ["bat"] 10 | ] 11 | */ 12 | 13 | var groupAnagrams = function (strs) { 14 | const map = new Map() 15 | for (let str of strs) { 16 | let array = Array.from(str) 17 | array.sort() 18 | let key = array.toString() 19 | let list = map.get(key) ? map.get(key) : new Array() 20 | list.push(str) 21 | map.set(key, list) 22 | } 23 | return Array.from(map.values()) 24 | } 25 | -------------------------------------------------------------------------------- /5.Daily Challenge/509. 斐波那契数.js: -------------------------------------------------------------------------------- 1 | // 509. 斐波那契数 2 | var fib = function (N) { 3 | return N === 0 ? 0 : N < 3 ? 1 : fib(N - 1) + fib(N - 2) 4 | } 5 | 6 | // 动态规划 7 | var fib = function (N) { 8 | let dp = new Uint32Array(N + 1) 9 | let i = 1 10 | dp[1] = 1 11 | while (i++ < N) dp[i] = dp[i - 1] + dp[i - 2] 12 | return N ? dp[N] : 0 13 | } 14 | -------------------------------------------------------------------------------- /5.Daily Challenge/538. 把二叉搜索树转换为累加树.js: -------------------------------------------------------------------------------- 1 | // 538. 把二叉搜索树转换为累加树 2 | var convertBST = function (root) { 3 | let sum = 0 4 | const traverse = (root) => { 5 | if (!root) return 6 | traverse(root.right) 7 | sum += root.val 8 | root.val = sum 9 | traverse(root.left) 10 | } 11 | traverse(root) 12 | return root 13 | } 14 | -------------------------------------------------------------------------------- /5.Daily Challenge/56.合并区间.js: -------------------------------------------------------------------------------- 1 | // intervals 形如 [[1,3],[2,6]...] 2 | // 56.合并区间 3 | function merge(intervals) { 4 | if (intervals.length == 0) return [] 5 | intervals.sort((a, b) => a[0] - b[0]) 6 | let res = [] 7 | res.push(intervals[0]) 8 | for (let i = 1; i < intervals.length; i++) { 9 | curr = intervals[i] 10 | last = res[res.length - 1] 11 | if (curr[0] <= last[1]) { 12 | last[1] = Math.max(last[1], curr[1]) 13 | } else { 14 | res.push(Array.from(curr)) 15 | } 16 | } 17 | return res 18 | } 19 | -------------------------------------------------------------------------------- /5.Daily Challenge/563. 二叉树的坡度.js: -------------------------------------------------------------------------------- 1 | // 563. 二叉树的坡度 2 | var findTilt = function (root) { 3 | let sum = 0 4 | const helper = (root) => { 5 | if (!root) { 6 | return 0 7 | } 8 | let leftVal = helper(root.left) 9 | let rightVal = helper(root.right) 10 | // 到最底层的点了; 11 | sum += Math.abs(leftVal - rightVal) 12 | return leftVal + rightVal + root.val 13 | } 14 | helper(root) 15 | return sum 16 | } 17 | -------------------------------------------------------------------------------- /5.Daily Challenge/57.插入区间.js: -------------------------------------------------------------------------------- 1 | // 57.插入区间 2 | var insert = function (intervals, newInterval) { 3 | let i = 0 4 | let res = [] 5 | let len = intervals.length 6 | if (len == 0) return [newInterval] 7 | intervals.push(newInterval) 8 | intervals.sort((a, b) => a[0] - b[0]) 9 | len++ 10 | 11 | while (i < len) { 12 | let currLeft = intervals[i][0] 13 | let currRight = intervals[i][1] 14 | while (i < len - 1 && intervals[i + 1][0] <= currRight) { 15 | i++ 16 | currRight = Math.max(intervals[i][1], currRight) 17 | } 18 | res.push([currLeft, currRight]) 19 | i++ 20 | } 21 | return res 22 | } 23 | -------------------------------------------------------------------------------- /5.Daily Challenge/633. 平方数之和.js: -------------------------------------------------------------------------------- 1 | // 633. 平方数之和 --双指针 2 | // 给定一个非负整数 c ,你要判断是否存在两个整数 a 和 b,使得 a2 + b2 = c 。 3 | var judgeSquareSum = function (c) { 4 | let left = 0 5 | let right = Math.floor(c ** 0.5) 6 | while (left <= right) { 7 | let sum = left ** 2 + right ** 2 8 | if (sum == c) return true 9 | // 如果平方和大于c,则将右指针减一,反之将左指针加一 10 | if (sum > c) right-- 11 | else left++ 12 | } 13 | return false 14 | } 15 | -------------------------------------------------------------------------------- /5.Daily Challenge/643. 子数组最大平均数 I.js: -------------------------------------------------------------------------------- 1 | /* 2 | 643. 子数组最大平均数 I 3 | 4 | 5 | 给定 n 个整数,找出平均数最大且长度为 k 的连续子数组,并输出该最大平均数。 6 | 输入:[1,12,-5,-6,50,3], k = 4 7 | 输出:12.75 8 | 解释:最大平均数 (12-5-6+50)/4 = 51/4 = 12.75 9 | */ 10 | function findMaxAverage(arr, k) { 11 | let len = arr.length 12 | let sum = 0 13 | arr.some((item, index) => { 14 | if (index > k - 1) return true 15 | sum += item 16 | }) 17 | let res = sum 18 | for (let i = 1; i + k - 1 < len; i++) { 19 | //窗口长度不变, 加右减左 20 | sum += arr[i + k - 1] - arr[i - 1] 21 | res = Math.max(res, sum) 22 | } 23 | return res / k 24 | } 25 | -------------------------------------------------------------------------------- /5.Daily Challenge/714. 买卖股票的最佳时机含手续费.js: -------------------------------------------------------------------------------- 1 | // 714. 买卖股票的最佳时机含手续费 2 | function maxProfit(prices, fee) { 3 | let n = prices.length 4 | let dp_i_0 = 0, 5 | dp_i_1 = Number.MIN_SAFE_INTEGER 6 | for (let i = 0; i < n; i++) { 7 | let temp = dp_i_0 8 | dp_i_0 = Math.max(dp_i_0, dp_i_1 + prices[i]) 9 | dp_i_1 = Math.max(dp_i_1, temp - prices[i] - fee) 10 | } 11 | return dp_i_0 12 | } 13 | -------------------------------------------------------------------------------- /5.Daily Challenge/746. 使用最小花费爬楼梯.js: -------------------------------------------------------------------------------- 1 | // 746. 使用最小花费爬楼梯 2 | // 动态规划 3 | /* 4 | dp[i]从i出发成本,dp = [cost[0], cost[1]],从0到cost.length,到终点前 5 | 从1步前或2步前出发。(dp[cost.length - 2], dp[cost.length - 1])取小即解 6 | dp[i] = cost[i] + (dp[i - 1], dp[i - 2])取小 7 | */ 8 | var minCostClimbingStairs = function (cost) { 9 | // let dp = new Array(cost.length + 1).fill(0); 10 | let dp = new Uint32Array(cost.length + 1) //JavaScript 类型化数组, 11 | let i = 1 12 | while (i++ < cost.length) dp[i] = Math.min(dp[i - 2] + cost[i - 2], dp[i - 1] + cost[i - 1]) 13 | return dp[i - 1] 14 | } 15 | -------------------------------------------------------------------------------- /5.Daily Challenge/754. 到达终点数字.js: -------------------------------------------------------------------------------- 1 | // 754. 到达终点数字 2 | function reachNumber(target) { 3 | target = Math.abs(target) 4 | let sum = 0 5 | let n = 0 6 | while (sum < target || (sum - target) % 2 != 0) { 7 | sum += n 8 | n++ 9 | } 10 | return n - 1 11 | } 12 | 13 | /* 14 | 思路概述: 15 | 给一个target,不管值是正值还是负值,需要的步数是同样的,所以我们统一考虑为正值,统一取绝对值。 16 | 向右走是加,向左走是减,那我们可以先不停的向右走,那么走的格数就是1+2+3+… 当无法得到给定的target值 17 | 时,代表我们其中是有几步是需要向左走的,那么向左走一步,会导致结果减小2对应的步数。 18 | 比如第二格我们向左,本来是加2,现在是减2,一来一去少了2*2=4格。 19 | 所以我们可以不断累加,直到遇到sum值-target是偶数的情况,当前走的步数就是结果 20 | 21 | */ 22 | -------------------------------------------------------------------------------- /5.Daily Challenge/766.托普利茨矩阵.js: -------------------------------------------------------------------------------- 1 | // 766.托普利茨矩阵 2 | 3 | // 除了左下角和右上角不需要遍历,其他点开始遍历 4 | 5 | const isToeplitzMatrix = function (matrix) { 6 | const r = matrix.length 7 | const c = matrix[0].length 8 | 9 | for (let i = 0; i < r - 1; i++) { 10 | for (let j = 0; j < c - 1; j++) { 11 | if (matrix[i][j] != matrix[i + 1][j + 1]) { 12 | return false 13 | } 14 | } 15 | } 16 | return true 17 | } 18 | -------------------------------------------------------------------------------- /5.Daily Challenge/80.删除排序数组中的重复项 II.js: -------------------------------------------------------------------------------- 1 | /* 2 | 80.删除排序数组中的重复项 II 3 | 输入:nums = [0,0,1,1,1,1,2,3,3] 4 | 输出:7, nums = [0,0,1,1,2,3,3] 5 | 解释:函数应返回新长度 length = 7, 并且原数组的前五个元素被修改为 0, 0, 1, 1, 2, 3, 3 。 6 | 你不需要考虑数组中超出新长度后面的元素。 7 | */ 8 | 9 | // ! 每跨越两个间隔,不相同则加1 10 | function removeDuplicates(arr) { 11 | let i = 0 12 | for (let n of arr) { 13 | if (i < 2 || n != arr[i - 2]) { 14 | arr[i] = n 15 | i++ 16 | } 17 | } 18 | return i 19 | } 20 | -------------------------------------------------------------------------------- /5.Daily Challenge/86. 分隔链表.js: -------------------------------------------------------------------------------- 1 | /* 2 | 86. 分隔链表 3 | 给你一个链表和一个特定值 x ,请你对链表进行分隔,使得所有小于 x 的节点都出现在大于或等于 x 的节点之前。 4 | 5 | 你应当保留两个分区中每个节点的初始相对位置。 6 | 7 |   8 | 9 | 示例: 10 | 11 | 输入:head = 1->4->3->2->5->2, x = 3 12 | 输出:1->2->2->4->3->5 13 | 14 | */ 15 | 16 | const partition = function (head, x) { 17 | let pA = (a = new ListNode(0)), 18 | pB = (b = new ListNode(0)) 19 | while (head) { 20 | head.val < x ? (a = a.next = head) : (b = b.next = head) 21 | head = head.next 22 | } 23 | a.next = pB.next 24 | b.next = null 25 | return pA.next 26 | } 27 | -------------------------------------------------------------------------------- /5.Daily Challenge/865. 具有所有最深节点的最小子树.js: -------------------------------------------------------------------------------- 1 | // 865. 具有所有最深节点的最小子树 2 | function depth(root) { 3 | if (root == null) return 0 4 | return Math.max(depth(root.left), depth(root.right)) + 1 5 | } 6 | function subtreeWithAllDeepest(root) { 7 | if (root == null) return root 8 | let dl = depth(root.left) 9 | let dr = depth(root.right) 10 | if (dl == dr) return root 11 | if (dl > dr) return subtreeWithAllDeepest(root.left) 12 | return subtreeWithAllDeepest(root.right) 13 | } 14 | -------------------------------------------------------------------------------- /5.Daily Challenge/867. 转置矩阵.js: -------------------------------------------------------------------------------- 1 | // 867. 转置矩阵 2 | /* 3 | 输入:matrix = [[1,2,3],[4,5,6],[7,8,9]] 4 | 输出:[[1,4,7],[2,5,8],[3,6,9]] 5 | 给你一个二维整数数组 matrix, 返回 matrix 的 转置矩阵 。 6 | 矩阵的 转置 是指将矩阵的主对角线翻转,交换矩阵的行索引与列索引。 7 | */ 8 | const transpose = function (matrix) { 9 | let l = matrix.length, 10 | w = matrix[0].length 11 | let arr = new Array(w).fill(0).map(() => new Array(l).fill(0)) 12 | for (let i = 0; i < l; i++) { 13 | for (let j = 0; j < w; j++) { 14 | arr[j][i] = matrix[i][j] 15 | } 16 | } 17 | return arr 18 | } 19 | -------------------------------------------------------------------------------- /5.Daily Challenge/888. 公平的糖果棒交换.js: -------------------------------------------------------------------------------- 1 | //888. 公平的糖果棒交换 2 | 3 | function fairCandySwap(A, B) { 4 | let sumA = A.reduce((prev, cur) => prev + cur, 0) 5 | let sumB = B.reduce((prev, cur) => prev + cur, 0) 6 | let target = (sumA + sumB) / 2 7 | let set = new Set(B) 8 | for (let a of A) { 9 | let b = target - (sumA - a) 10 | if (set.has(b)) { 11 | return [a, b] 12 | } 13 | } 14 | return [] 15 | } 16 | -------------------------------------------------------------------------------- /5.Daily Challenge/92.反转链表 II.js: -------------------------------------------------------------------------------- 1 | // 92.反转链表 II 2 | var sortArrayByParityII = function (A) { 3 | const len = A.length 4 | let j = 1 5 | for (let i = 0; i < len; i += 2) { 6 | // A[i]是奇数 7 | if (A[i] & 1) { 8 | // A[j]是奇数 9 | while (A[j] & 1) { 10 | j += 2 //直到遇到A[j]是偶数 11 | } 12 | ;[A[i], A[j]] = [A[j], A[i]] 13 | } 14 | } 15 | return A 16 | } 17 | -------------------------------------------------------------------------------- /5.Daily Challenge/941. 有效的山脉数组.js: -------------------------------------------------------------------------------- 1 | // 941. 有效的山脉数组 2 | const validMountainArray = (A) => { 3 | const n = A.length 4 | let i = 0 5 | let j = n - 1 6 | while (i + 1 < n && A[i] < A[i + 1]) { 7 | i++ 8 | } 9 | while (j - 1 >= 0 && A[j - 1] > A[j]) { 10 | j-- 11 | } 12 | if (i != 0 && i == j && j != n - 1) { 13 | return true 14 | } 15 | return false 16 | } 17 | 18 | const a = [0, 1, 2, 2, 5, 2, 1, 0] 19 | console.log(validMountainArray(a)) 20 | -------------------------------------------------------------------------------- /5.Daily Challenge/976. 三角形的最大周长.js: -------------------------------------------------------------------------------- 1 | // 976. 三角形的最大周长 2 | // 先排序,先取最大三个数,若较小两数和大于第三数,那么可以组成三角形, 3 | // 否则大的数过大,去掉,取剩下的数中最大的,重复此过程 4 | function largestPerimeter(A) { 5 | A.sort((a, b) => b - a) 6 | let max = 0 7 | for (let i = 0; i + 2 <= A.length; i++) { 8 | if (A[i + 1] + A[i + 2] > A[i]) { 9 | max = Math.max(max, A[i] + A[i + 1] + A[i + 2]) 10 | } 11 | } 12 | return max 13 | } 14 | -------------------------------------------------------------------------------- /5.Daily Challenge/978. 最长湍流子数组.js: -------------------------------------------------------------------------------- 1 | // 978. 最长湍流子数组 2 | // 滑动窗口 3 | const maxTurbulenceSize = function (arr) { 4 | let pre = '=' 5 | let i = 0 6 | let res = 1 7 | for (let j = 1; j < arr.length; j++) { 8 | let cur = arr[j - 1] === arr[j] ? '=' : arr[j - 1] > arr[j] ? '>' : '<' 9 | if (cur === pre) i = j - 1 10 | if (cur === '=') i = j 11 | res = Math.max(res, j - i + 1) 12 | pre = cur 13 | } 14 | return res 15 | } 16 | -------------------------------------------------------------------------------- /5.Daily Challenge/test.js: -------------------------------------------------------------------------------- 1 | const arr=[1,2,3,4,'aaa',2,222]; 2 | 3 | console.log(arr.splice(4,1)); 4 | console.log(arr); -------------------------------------------------------------------------------- /5.Daily Challenge/upstairs.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | function climbStairs(n){ 4 | let over=1000000007; 5 | const dp=new Array(n).fill(n); 6 | dp[0]=1; 7 | dp[1]=1; 8 | dp[2]=2; 9 | for(let i=3;i<=n;i++){ 10 | dp[i]=(dp[i-2]+dp[i-1])%over 11 | } 12 | return dp[n]; 13 | } 14 | console.log(climbStairs(8)) 15 | -------------------------------------------------------------------------------- /5.Daily Challenge/完全二叉树的节点个数.js: -------------------------------------------------------------------------------- 1 | // 完全二叉树的节点个数 2 | function countNodes(root) { 3 | return root == null ? 0 : countNodes(root.left) + countNodes(root.right) + 1 4 | } 5 | 6 | // BFS 7 | function countNodes(root) { 8 | if (!root) { 9 | return 0 10 | } 11 | let q = [] 12 | let sum = 0 13 | q.push(root) 14 | while (q.length !== 0) { 15 | for (let i = 0; i < q.length; i++) { 16 | let demo = q.shift() 17 | sum++ 18 | if (demo.left) q.push(demo.left) 19 | if (demo.right) q.push(demo.right) 20 | } 21 | } 22 | return sum 23 | } 24 | -------------------------------------------------------------------------------- /6.Challenges 310p.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Challenges 310p.zip -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/153.Find Minimum in Rotated Sorted Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/153.Find Minimum in Rotated Sorted Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/154.Find Minimum in Rotated Sorted Array II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/154.Find Minimum in Rotated Sorted Array II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/278.First Bad Version.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/278.First Bad Version.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/658.Find K Closest Elements.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/658.Find K Closest Elements.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/必背 34.Find First and Last Position of Element in Sorted Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/必背 34.Find First and Last Position of Element in Sorted Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/必背 702.Search in a Sorted Array of Unknown Size - 副本.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/必背 702.Search in a Sorted Array of Unknown Size - 副本.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/必背 704.Binary Search.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/朴素二分法 (7)/必背 704.Binary Search.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/302.Smallest Rectangle Enclosing Black Pixels.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/302.Smallest Rectangle Enclosing Black Pixels.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/81. Search in Rotated Sorted Array II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/81. Search in Rotated Sorted Array II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/852.Peak Index in a Mountain Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/852.Peak Index in a Mountain Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 162.Find Peak Element.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 162.Find Peak Element.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 33.Search in Rotated Sorted Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 33.Search in Rotated Sorted Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 4.Median of Two Sorted Arrays.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 4.Median of Two Sorted Arrays.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 74.Search a 2D Matrix.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/条件二分法 (7)/必背 74.Search a 2D Matrix.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/69.Sqrt(x).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/69.Sqrt(x).ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/Lint-183. Wood Cut.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/Lint-183. Wood Cut.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/Lint-437. Copy Books.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/Lint-437. Copy Books.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/Lint-438. Copy Books II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/Lint-438. Copy Books II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/必背 1283.Find the Smallest Divisor Given a Threshold.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/必背 1283.Find the Smallest Divisor Given a Threshold.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/必背 875.Koko Eating Bananas.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/1.二分法 21/答案二分法 6/必背 875.Koko Eating Bananas.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/index.md: -------------------------------------------------------------------------------- 1 | # 多指针问题 2 | 3 | 基本问题: 4 | (1)多指针是一个非常广泛的概念,并不是一个固定的算法。但基本上是通过一些变量的控制与循环把问题的复杂度控制在一两层for循环之内。可以用在数组、链表、区间、滑动窗口、流、回文串、和差问题等多个场景。(前项和其实并不完全是指针问题,但也归并在这里)。 5 | (2)Quick Sort和Merge Sort的基本原理与实现,排序的稳定性问题 6 | (3)Quick Select的实现与复杂度 7 | (4)同向指针与相向指针的使用场景 8 | (5)不同场景下循环终止条件? 9 | (6)两数之和,之差,特定条件下(大小于某值等)的计数问题 10 | (7)三数或三数以上之和的通用写法(两数之和+搜索) 11 | (8)数组有没有排序?是否需要排序? 12 | (9)数组有没有去重?是否需要去重? 13 | (10)离线数据(内存中,有限长)还是在线数据(无法放入内存,长度未知)? 14 | (11)链表操作中dummy node与previous node的使用技巧 15 | (12)链表的中点,判断是否有环,寻找环的交叉点 16 | 17 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/前缀和/238. Product of Array Except Self.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/前缀和/238. Product of Array Except Self.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/前缀和/303. Range Sum Query - Immutable.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/前缀和/303. Range Sum Query - Immutable.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/前缀和/325. Maximum Size Subarray Sum Equals k.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/前缀和/325. Maximum Size Subarray Sum Equals k.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/前缀和/528. Random Pick with Weight.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/前缀和/528. Random Pick with Weight.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/前缀和/560. Subarray Sum Equals K.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/前缀和/560. Subarray Sum Equals K.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/前缀和/重点 53. Maximum Subarray.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/前缀和/重点 53. Maximum Subarray.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/区间/252. Meeting Rooms.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/区间/252. Meeting Rooms.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/区间/253. Meeting Rooms II.ts: -------------------------------------------------------------------------------- 1 | // 253 Meeting Room II(Meeting Room I也可以使用) 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/区间/56. Merge Intervals.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/区间/56. Merge Intervals.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/区间/57. Insert Interval.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/区间/57. Insert Interval.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/区间/986. Interval List Intersections.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/区间/986. Interval List Intersections.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/区间/重点 Lint-391. Number of Airplanes in the Sky.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/区间/重点 Lint-391. Number of Airplanes in the Sky.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/1099. Two Sum Less Than K.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/1099. Two Sum Less Than K.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/15. 3Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/15. 3Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/167. Two Sum II - Input array is sorted.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/167. Two Sum II - Input array is sorted.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/170. Two Sum III - Data structure design.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/170. Two Sum III - Data structure design.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/18. 4Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/18. 4Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/259. 3Sum Smaller.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/259. 3Sum Smaller.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/653. Two Sum IV - Input is a BST.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/653. Two Sum IV - Input is a BST.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-382. Triangle Count.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-382. Triangle Count.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-443. Two Sum - Greater than target.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-443. Two Sum - Greater than target.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-533. Two Sum - Closet to target.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-533. Two Sum - Closet to target.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-57. 3Sum Closest.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-57. 3Sum Closest.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-587. Two Sum - Unique pairs.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-587. Two Sum - Unique pairs.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-609. Two Sum - Less than or equals to target.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-609. Two Sum - Less than or equals to target.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-610. Two Sum - Difference equals to target.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/Lint-610. Two Sum - Difference equals to target.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/和差问题/重点 1. Two Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/和差问题/重点 1. Two Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/回文字符串/125. Valid Palindrome.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/回文字符串/125. Valid Palindrome.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/回文字符串/重点 345. Reverse Vowels of a String.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/回文字符串/重点 345. Reverse Vowels of a String.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/回文字符串/重点 5. Longest Palindromic Substring.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/回文字符串/重点 5. Longest Palindromic Substring.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/回文字符串/重点 680. Valid Palindrome II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/回文字符串/重点 680. Valid Palindrome II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/215.Kth Largest Element in an Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/215.Kth Largest Element in an Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/283.Move Zeroes.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/283.Move Zeroes.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/347. Top K Frequent Elements.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/347. Top K Frequent Elements.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/349. Intersection of Two Arrays.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/349. Intersection of Two Arrays.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/350. Intersection of Two Arrays II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/350. Intersection of Two Arrays II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/42. Trapping Rain Water.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/42. Trapping Rain Water.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/43. Multiply Strings.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/43. Multiply Strings.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/80.Remove Duplicates from Sorted Array II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/80.Remove Duplicates from Sorted Array II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/845. Longest Mountain in Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/845. Longest Mountain in Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/88.Merge Sorted Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/88.Merge Sorted Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/969. Pancake Sorting.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/969. Pancake Sorting.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/Lint-143. Sort Color II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/Lint-143. Sort Color II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/Lint-31. Partition Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/Lint-31. Partition Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/Lint-461. Kth Smallest Numbers in Unsorted Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/Lint-461. Kth Smallest Numbers in Unsorted Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/Lint-544. Top k Largest Numbers.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/Lint-544. Top k Largest Numbers.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/Lint-625. Partition Array II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/数组/Lint-625. Partition Array II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/必背 26.Remove Duplicates from Sorted Array.ts: -------------------------------------------------------------------------------- 1 | // https://leetcode.com/problems/remove-duplicates-from-sorted-array/ 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/必背 75.Sort Colors.ts: -------------------------------------------------------------------------------- 1 | // https://leetcode.com/problems/sort-colors/ 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/数组/必背 912.Sort an Array (Quick Sort and Merge Sort).ts: -------------------------------------------------------------------------------- 1 | // https://leetcode.com/problems/sort-an-array/ 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/流/346. Moving Average from Data Stream.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/流/346. Moving Average from Data Stream.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/流/352. Data Stream as Disjoint Intervals.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/流/352. Data Stream as Disjoint Intervals.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/流/703. Kth Largest Element in a Stream.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/流/703. Kth Largest Element in a Stream.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/流/重点 295. Find Median from Data Stream.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/流/重点 295. Find Median from Data Stream.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/11. Container With Most Water.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/11. Container With Most Water.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/209. Minimum Size Subarray Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/209. Minimum Size Subarray Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/239. Sliding Window Maximum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/239. Sliding Window Maximum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/395. Longest Substring with At Least K Repeating Characters.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/395. Longest Substring with At Least K Repeating Characters.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/480. Sliding Window Median.ts: -------------------------------------------------------------------------------- 1 | // 480. Sliding Window Median (这个题用 TreeMap 超级方便) 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/567. Permutation in String.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/567. Permutation in String.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/713. Subarray Product Less Than K.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/713. Subarray Product Less Than K.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/727. Minimum Window Subsequence.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/727. Minimum Window Subsequence.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/76. Minimum Window Substring.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/76. Minimum Window Substring.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/Lint-604. Window Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/Lint-604. Window Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/滑动窗口/重点 3. Longest Substring Without Repeating Characters.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/滑动窗口/重点 3. Longest Substring Without Repeating Characters.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/141. Linked List Cycle.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/141. Linked List Cycle.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/142. Linked List Cycle II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/142. Linked List Cycle II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/160. Intersection of Two Linked Lists.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/160. Intersection of Two Linked Lists.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/234. Palindrome Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/234. Palindrome Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/287. Find the Duplicate Number.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/287. Find the Duplicate Number.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/328. Odd Even Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/328. Odd Even Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/86. Partition List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/86. Partition List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/876. Middle of the Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/876. Middle of the Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/2.多指针 75/链表/必背 21. Merge Two Sorted Lists.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/2.多指针 75/链表/必背 21. Merge Two Sorted Lists.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/index.md: -------------------------------------------------------------------------------- 1 | 宽度优先搜索 2 | 3 | 基本问题: 4 | (1)如果复杂程度类似, 面试中尽量优先使用 BFS 5 | (2)BFS 主要几种场景: 层级遍历,拓扑排序,图上搜索(包括二叉树,矩阵) 6 | (3)Queue 的使用技巧,BFS 的终止条件? 7 | (4)什么时候使用分层?什么时候不需要?实现的时候的区别在哪里? 8 | (5)拓扑排序的概念?如何判断是否存在拓扑排序?是否存在唯一的拓扑排序?找到所有拓扑排序? 9 | (6)什么时候需要使用 set 记录访问过的节点?(为什么二叉树上的 BFS 往往不需要 set?)什么时候需要 map 记录到达过的节点距离? 10 | (7)如何在矩阵中遍历下一步的所有节点?如果每次可能走不止一步怎么办(Maze II)? 11 | (8)为什么 BFS 解决的基本都是简单图(边长为 1)问题?如果边长不为 1,该怎么办? 12 | (9)BFS 的时空复杂度估算? 13 | (10)如何使用双向 BFS 进行优化? 14 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/102. Binary Tree Level Order Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/102. Binary Tree Level Order Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/103. Binary Tree Zigzag Level Order Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/103. Binary Tree Zigzag Level Order Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/107. Binary Tree Level Order Traversal II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/107. Binary Tree Level Order Traversal II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/513. Find Bottom Left Tree Value.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/513. Find Bottom Left Tree Value.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/Lint-242. Convert Binary Tree to Linked Lists by Depth.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/Lint-242. Convert Binary Tree to Linked Lists by Depth.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/重点 297. Serialize and Deserialize Binary Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/二叉树/重点 297. Serialize and Deserialize Binary Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/127. Word Ladder.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/127. Word Ladder.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/1306. Jump Game III.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/1306. Jump Game III.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/261. Graph Valid Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/261. Graph Valid Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/323. Number of Connected Components in an Undirected Graph.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/323. Number of Connected Components in an Undirected Graph.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/841. Keys and Rooms.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/841. Keys and Rooms.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/Lint-531. Six Degree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/Lint-531. Six Degree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/Lint-618. Search Graph Nodes.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/Lint-618. Search Graph Nodes.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/Lint-624. Remove Substrings.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/Lint-624. Remove Substrings.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/重点 133. Clone Graph.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/图/重点 133. Clone Graph.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/207. Course Schedule.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/207. Course Schedule.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/210. Course Schedule II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/210. Course Schedule II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/269. Alien Dictionary.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/269. Alien Dictionary.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/444. Sequence Reconstruction.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/444. Sequence Reconstruction.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/重点 Lint-127. Topological Sorting.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/拓扑排序/重点 Lint-127. Topological Sorting.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/305. Number of Islands II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/305. Number of Islands II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/490. The Maze.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/490. The Maze.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/505. The Maze II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/505. The Maze II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/542. 01 Matrix.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/542. 01 Matrix.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/733. Flood Fill.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/733. Flood Fill.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/773. Sliding Puzzle.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/773. Sliding Puzzle.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/994. Rotting Oranges.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/994. Rotting Oranges.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-573. Build Post Office II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-573. Build Post Office II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-598. Zombie in Matrix.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-598. Zombie in Matrix.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-611. Knight Shortest Path.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-611. Knight Shortest Path.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-794. Sliding Puzzle II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/Lint-794. Sliding Puzzle II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/重点 200. Number of Islands.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/3.广度优先搜索 BFS 33/矩阵/重点 200. Number of Islands.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/LCA问题/236. Lowest Common Ancestor of a Binary Tree.ts: -------------------------------------------------------------------------------- 1 | // 236 Lowest Common Ancestor of a Binary Tree (相似题:235、1650) 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/LCA问题/Lint-474. Lowest Common Ancestor II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/LCA问题/Lint-474. Lowest Common Ancestor II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/LCA问题/Lint-578. Lowest Common Ancestor III.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/LCA问题/Lint-578. Lowest Common Ancestor III.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/index.md: -------------------------------------------------------------------------------- 1 | 二叉树与递归 2 | 3 | 基本问题: 4 | (1)理解二叉树、平衡二叉树、二叉搜索树的关系和概念。 5 | (2)理解递归的概念和方法,递归三要素。 6 | (3)在解决递归问题的时候,有时可以返回多个值(Python),或者用一个额外的 class 包装多个值(Java)。 7 | (4)熟练掌握用递归和非递归的方式分别前序、中序、后序遍历二叉树的方法。 8 | (5)理解掌握分治和遍历的区别和联系。 9 | (6)理解掌握 top-down, buttom-up 的思路。 10 | (7)理解掌握二叉树上的 Iterator。 11 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/其他/114. Flatten Binary Tree to Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/其他/114. Flatten Binary Tree to Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/其他/199. Binary Tree Right Side View.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/其他/199. Binary Tree Right Side View.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/其他/331. Verify Preorder Serialization of a Binary Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/其他/331. Verify Preorder Serialization of a Binary Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/其他/449. Serialize and Deserialize BST.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/其他/449. Serialize and Deserialize BST.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/其他/513. Find Bottom Left Tree Value.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/其他/513. Find Bottom Left Tree Value.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/100. Same Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/100. Same Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/101. Symmetric Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/101. Symmetric Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/110. Balanced Binary Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/110. Balanced Binary Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/98. Validate Binary Search Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/判断树的形态/98. Validate Binary Search Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/前中后序遍历/重点 144. Binary Tree Preorder Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/前中后序遍历/重点 144. Binary Tree Preorder Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/前中后序遍历/重点 145. Binary Tree Postorder Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/前中后序遍历/重点 145. Binary Tree Postorder Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/前中后序遍历/重点 94. Binary Tree Inorder Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/前中后序遍历/重点 94. Binary Tree Inorder Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/反向复原二叉树/106. Construct Binary Tree from Inorder and Postorder Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/反向复原二叉树/106. Construct Binary Tree from Inorder and Postorder Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/反向复原二叉树/889. Construct Binary Tree from Preorder and Postorder Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/反向复原二叉树/889. Construct Binary Tree from Preorder and Postorder Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/反向复原二叉树/重点 105. Construct Binary Tree from Preorder and Inorder Traversal.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/反向复原二叉树/重点 105. Construct Binary Tree from Preorder and Inorder Traversal.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/104. Maximum Depth of Binary Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/104. Maximum Depth of Binary Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/111. Minimum Depth of Binary Tree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/111. Minimum Depth of Binary Tree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/333. Largest BST Subtree.ts: -------------------------------------------------------------------------------- 1 | // 类似 98 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/Lint-596. Minimum Subtree.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/Lint-596. Minimum Subtree.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/Lint-597. Subtree with Maximum Average.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/子树相关问题/Lint-597. Subtree with Maximum Average.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/112. Path Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/112. Path Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/113. Path Sum II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/113. Path Sum II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/124. Binary Tree Maximum Path Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/124. Binary Tree Maximum Path Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/298. Binary Tree Longest Consecutive Sequence.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/298. Binary Tree Longest Consecutive Sequence.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/549. Binary Tree Longest Consecutive Sequence II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/549. Binary Tree Longest Consecutive Sequence II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/Lint-475. Binary Tree Maximum Path Sum II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/Lint-475. Binary Tree Maximum Path Sum II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/Lint-619. Binary Tree Longest Consecutive Sequence III.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/路径相关问题/Lint-619. Binary Tree Longest Consecutive Sequence III.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/230. Kth Smallest Element in a BST.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/230. Kth Smallest Element in a BST.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/270. Closest Binary Search Tree Value.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/270. Closest Binary Search Tree Value.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/272. Closest Binary Search Tree Value II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/272. Closest Binary Search Tree Value II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/285. Inorder Successor in BST.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/285. Inorder Successor in BST.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/510. Inorder Successor in BST II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/510. Inorder Successor in BST II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/Lint-915. Inorder Predecessor in BST II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/4.二叉树与递归 38/遍历器相关/Lint-915. Inorder Predecessor in BST II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/index.md: -------------------------------------------------------------------------------- 1 | 深度优先搜索 2 | 3 | 基本问题: 4 | (1)DFS 中递归的基本要素 5 | (2)终止条件的选择;回溯;剪枝 6 | (3)什么时候需要排序? 7 | (4)如何去除重复元素?一个元素允许使用多次的情况? 8 | (6)在图上进行 DFS 如何避免回到重复节点 9 | (5)识别一个隐式图,并使用 DFS 10 | (6)在某些情况下,利用记忆化搜索进行优化 11 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/113. Path Sum II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/113. Path Sum II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/257. Binary Tree Paths.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/257. Binary Tree Paths.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/Lint-246. Binary Tree Path Sum II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/Lint-246. Binary Tree Path Sum II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/Lint-376. Binary Tree Path Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/Lint-376. Binary Tree Path Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/Lint-472. Binary Tree Path Sum III.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/二叉树/Lint-472. Binary Tree Path Sum III.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/1192. Critical Connections in a Network.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/1192. Critical Connections in a Network.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/126. Word Ladder II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/126. Word Ladder II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/140. Word Break II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/140. Word Break II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/290. Word Pattern.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/290. Word Pattern.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/291. Word Pattern II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/291. Word Pattern II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/494. Target Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/图/494. Target Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/131. Palindrome Partitioning.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/131. Palindrome Partitioning.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/17. Letter Combinations of a Phone Number.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/17. Letter Combinations of a Phone Number.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/22. Generate Parentheses.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/22. Generate Parentheses.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/254. Factor Combinations.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/254. Factor Combinations.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/301. Remove Invalid Parentheses.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/301. Remove Invalid Parentheses.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/37. Sudoku Solver.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/37. Sudoku Solver.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/46. Permutations.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/46. Permutations.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/491. Increasing Subsequences.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/491. Increasing Subsequences.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/51. N-Queens.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/51. N-Queens.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/52. N-Queens II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/52. N-Queens II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/93. Restore IP Addresses.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/93. Restore IP Addresses.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/Lint-10. String Permutation II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/Lint-10. String Permutation II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/Lint-570. Find the Missing Number II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/Lint-570. Find the Missing Number II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/Lint-680. Split String.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/Lint-680. Split String.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 39. Combination Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 39. Combination Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 40. Combination Sum II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 40. Combination Sum II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 47. Permutations II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 47. Permutations II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 77. Combinations.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 77. Combinations.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 78. Subsets.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 78. Subsets.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 90. Subsets II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/5.深度优先搜索 DFS 32/排列组合/重点 90. Subsets II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/315. Count of Smaller Numbers After Self.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/315. Count of Smaller Numbers After Self.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/327. Count of Range Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/327. Count of Range Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/493. Reverse Pairs.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/493. Reverse Pairs.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/715. Range Module.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/715. Range Module.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/重点 307. Range Sum Query - Mutable.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/二叉索引树和段树/重点 307. Range Sum Query - Mutable.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/单调栈/1019. Next Greater Node In Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/单调栈/1019. Next Greater Node In Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/单调栈/239. Sliding Window Maximum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/单调栈/239. Sliding Window Maximum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/单调栈/84. Largest Rectangle in Histogram.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/单调栈/84. Largest Rectangle in Histogram.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/单调栈/重点 300. Longest Increasing Subsequence (Patience Sort).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/单调栈/重点 300. Longest Increasing Subsequence (Patience Sort).ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/哈希表/128. Longest Consecutive Sequence.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/哈希表/128. Longest Consecutive Sequence.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/哈希表/290. Word Pattern.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/哈希表/290. Word Pattern.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/哈希表/49. Group Anagrams.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/哈希表/49. Group Anagrams.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/哈希表/560. Subarray Sum Equals K.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/哈希表/560. Subarray Sum Equals K.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/哈希表/953. Verifying an Alien Dictionary.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/哈希表/953. Verifying an Alien Dictionary.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/哈希表/重点 706. Design HashMap.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/哈希表/重点 706. Design HashMap.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/295. Find Median from Data Stream.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/295. Find Median from Data Stream.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/347. Top K Frequent Elements.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/347. Top K Frequent Elements.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/480. Sliding Window Median.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/480. Sliding Window Median.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/692. Top K Frequent Words.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/692. Top K Frequent Words.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/703. Kth Largest Element in a Stream.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/703. Kth Largest Element in a Stream.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/767. Reorganize String.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/767. Reorganize String.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/973. K Closest Points to Origin.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/973. K Closest Points to Origin.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/堆/重点 23. Merge k Sorted Lists.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/堆/重点 23. Merge k Sorted Lists.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/1396. Design Underground System.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/1396. Design Underground System.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/211. Design Add and Search Words Data Structure.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/211. Design Add and Search Words Data Structure.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/380. Insert Delete GetRandom O(1).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/380. Insert Delete GetRandom O(1).ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/528. Random Pick with Weight.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/528. Random Pick with Weight.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/588. Design In-Memory File System.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/588. Design In-Memory File System.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/981. Time Based Key-Value Store.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/981. Time Based Key-Value Store.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/重点 146. LRU Cache.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/重点 146. LRU Cache.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/重点 460. LFU Cache.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/复杂数据结构/重点 460. LFU Cache.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字典树/1032. Stream of Characters.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字典树/1032. Stream of Characters.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字典树/211. Design Add and Search Words Data Structure.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字典树/211. Design Add and Search Words Data Structure.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字典树/重点 208. Implement Trie (Prefix Tree).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字典树/重点 208. Implement Trie (Prefix Tree).ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字符串/13. Roman to Integer.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字符串/13. Roman to Integer.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字符串/14. Longest Common Prefix.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字符串/14. Longest Common Prefix.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字符串/443. String Compression.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字符串/443. String Compression.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字符串/6. ZigZag Conversion.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字符串/6. ZigZag Conversion.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/字符串/68. Text Justification.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/字符串/68. Text Justification.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/并查集/305. Number of Islands II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/并查集/305. Number of Islands II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/并查集/323. Number of Connected Components in an Undirected Graph.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/并查集/323. Number of Connected Components in an Undirected Graph.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/并查集/重点 200. Number of Islands.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/并查集/重点 200. Number of Islands.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/扫描线/252. Meeting Rooms.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/扫描线/252. Meeting Rooms.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/扫描线/253. Meeting Rooms II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/扫描线/253. Meeting Rooms II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/扫描线/Lint-391. Number of Airplanes in the Sky.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/扫描线/Lint-391. Number of Airplanes in the Sky.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/数组/289. Game of Life.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/数组/289. Game of Life.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/数组/442. Find All Duplicates in an Array.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/数组/442. Find All Duplicates in an Array.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/数组/48. Rotate Image.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/数组/48. Rotate Image.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/数组/54. Spiral Matrix.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/数组/54. Spiral Matrix.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/数组/73. Set Matrix Zeroes.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/数组/73. Set Matrix Zeroes.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/栈/1249. Minimum Remove to Make Valid Parentheses.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/栈/1249. Minimum Remove to Make Valid Parentheses.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/栈/20. Valid Parentheses.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/栈/20. Valid Parentheses.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/栈/224. Basic Calculator.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/栈/224. Basic Calculator.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/栈/227. Basic Calculator II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/栈/227. Basic Calculator II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/栈/394. Decode String.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/栈/394. Decode String.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/栈/85. Maximal Rectangle.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/栈/85. Maximal Rectangle.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/栈/重点 155. Min Stack.ts: -------------------------------------------------------------------------------- 1 | // 155. Min Stack (follow up Leetcode 716 Max Stack).ts 2 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/138. Copy List with Random Pointer.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/138. Copy List with Random Pointer.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/141. Linked List Cycle.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/141. Linked List Cycle.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/142. Linked List Cycle II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/142. Linked List Cycle II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/148. Sort List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/148. Sort List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/160. Intersection of Two Linked Lists.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/160. Intersection of Two Linked Lists.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/203. Remove Linked List Elements.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/203. Remove Linked List Elements.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/206. Reverse Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/206. Reverse Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/234. Palindrome Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/234. Palindrome Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/328. Odd Even Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/328. Odd Even Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/445. Add Two Numbers II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/445. Add Two Numbers II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/83. Remove Duplicates from Sorted List.py: -------------------------------------------------------------------------------- 1 | class Solution(object): 2 | def deleteDuplicates(self, head): 3 | if not head: 4 | return None 5 | prev, cur = head, head.next 6 | while cur: 7 | if cur.val == prev.val: 8 | prev.next = cur.next 9 | else: 10 | prev = cur 11 | cur = cur.next 12 | return head 13 | -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/86. Partition List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/86. Partition List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/876. Middle of the Linked List.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/876. Middle of the Linked List.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/92. Reverse Linked List II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/92. Reverse Linked List II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/重点 2. Add Two Numbers.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/重点 2. Add Two Numbers.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/6.数据结构 76/链表/重点 21. Merge Two Sorted Lists.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/6.数据结构 76/链表/重点 21. Merge Two Sorted Lists.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/Greedy贪心/45. Jump Game II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/Greedy贪心/45. Jump Game II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/Greedy贪心/55. Jump Game.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/Greedy贪心/55. Jump Game.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/Greedy贪心/763. Partition Labels.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/Greedy贪心/763. Partition Labels.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/Sections/87. Scramble String.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/Sections/87. Scramble String.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/Sections/重点 312. Burst Balloons.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/Sections/重点 312. Burst Balloons.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/Sections/重点 516. Longest Palindromic Subsequence.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/Sections/重点 516. Longest Palindromic Subsequence.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/其他/132. Palindrome Partitioning II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/其他/132. Palindrome Partitioning II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/其他/279. Perfect Squares.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/其他/279. Perfect Squares.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/其他/639. Decode Ways II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/其他/639. Decode Ways II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/其他/Lint-395. Coins in a Line II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/其他/Lint-395. Coins in a Line II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/其他/Lint-396. Coins in a Line III.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/其他/Lint-396. Coins in a Line III.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/其他/重点 91. Decode Ways.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/其他/重点 91. Decode Ways.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/其他/重点 Lint-394. Coins in a Line.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/其他/重点 Lint-394. Coins in a Line.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/122. Best Time to Buy and Sell Stock II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/122. Best Time to Buy and Sell Stock II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/123. Best Time to Buy and Sell Stock III.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/123. Best Time to Buy and Sell Stock III.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/188. Best Time to Buy and Sell Stock IV.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/188. Best Time to Buy and Sell Stock IV.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/256. Paint House.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/256. Paint House.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/265. Paint House II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/265. Paint House II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/Lint-843. Digital Flip.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/Lint-843. Digital Flip.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/重点 121. Best Time to Buy and Sell Stock.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/重点 121. Best Time to Buy and Sell Stock.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/单序列/重点 139. Word Break.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/单序列/重点 139. Word Break.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/双序列/1143. Longest Common Subsequence.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/双序列/1143. Longest Common Subsequence.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/双序列/115. Distinct Subsequences.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/双序列/115. Distinct Subsequences.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/双序列/44. Wildcard Matching.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/双序列/44. Wildcard Matching.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/双序列/72. Edit Distance.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/双序列/72. Edit Distance.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/双序列/97. Interleaving String.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/双序列/97. Interleaving String.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/双序列/重点 10. Regular Expression Matching.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/双序列/重点 10. Regular Expression Matching.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/221. Maximal Square.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/221. Maximal Square.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/361. Bomb Enemy.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/361. Bomb Enemy.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/64. Minimum Path Sum.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/64. Minimum Path Sum.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/85. Maximal Rectangle.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/85. Maximal Rectangle.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/重点 62. Unique Paths.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/重点 62. Unique Paths.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/重点 63. Unique Paths II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/矩阵/重点 63. Unique Paths II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/474. Ones and Zeroes.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/474. Ones and Zeroes.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-125. Backpack II.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-125. Backpack II.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-440. Backpack III.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-440. Backpack III.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-562. Backpack IV.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-562. Backpack IV.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-563. Backpack V.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-563. Backpack V.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-564. Backpack VI (Combination Sum IV).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-564. Backpack VI (Combination Sum IV).ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-971. Surplus Value Backpack.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/Lint-971. Surplus Value Backpack.ts -------------------------------------------------------------------------------- /6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/重点 Lint-92. Backpack.ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/6.Sorted Challenges 310p/7.动态规划DP 42/背包问题/重点 Lint-92. Backpack.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/BFS/图/1091. Shortest Path in Binary Matrix.ts: -------------------------------------------------------------------------------- 1 | // 1091. Shortest Path in Binary Matrix.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/BFS/图/1293. Shortest Path in a Grid with Obstacles Elimination.ts: -------------------------------------------------------------------------------- 1 | // 1293. Shortest Path in a Grid with Obstacles Elimination.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/BFS/图/130. Surrounded Regions.ts: -------------------------------------------------------------------------------- 1 | // 130. Surrounded Regions.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/BFS/图/752. Open the Lock.ts: -------------------------------------------------------------------------------- 1 | // 752. Open the Lock.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/BFS/图/815. Bus Routes.ts: -------------------------------------------------------------------------------- 1 | // 815. Bus Routes.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/BFS/树/314 Binary Tree Vertical Order Traversal.ts: -------------------------------------------------------------------------------- 1 | // 314 Binary Tree Vertical Order Traversal.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/显式二分法/1095. Find in Mountain Array.ts: -------------------------------------------------------------------------------- 1 | // 1095. Find in Mountain Array.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/显式二分法/240. Search a 2D Matrix II.ts: -------------------------------------------------------------------------------- 1 | // 240. Search a 2D Matrix II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/隐式二分法/1060. Missing Element in Sorted Array.ts: -------------------------------------------------------------------------------- 1 | // 1060. Missing Element in Sorted Array.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/隐式二分法/1062. Longest Repeating Substring.ts: -------------------------------------------------------------------------------- 1 | // 1062. Longest Repeating Substring.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/隐式二分法/1300. Sum of Mutated Array Closest to Target.ts: -------------------------------------------------------------------------------- 1 | // 1300. Sum of Mutated Array Closest to Target.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/隐式二分法/1891. Cutting Ribbons.ts: -------------------------------------------------------------------------------- 1 | // 1891. Cutting Ribbons.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/隐式二分法/540. Single Element in a Sorted Array.ts: -------------------------------------------------------------------------------- 1 | // 540. Single Element in a Sorted Array.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Binary Search/隐式二分法/644. Maximum Average Subarray II.ts: -------------------------------------------------------------------------------- 1 | // 644. Maximum Average Subarray II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/二叉搜索树BST/108 Convert Sorted Array to Binary Search Tree.ts: -------------------------------------------------------------------------------- 1 | // 108 Convert Sorted Array to Binary Search Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/二叉搜索树BST/235 Lowest Common Ancestor of a Binary Search Tree.ts: -------------------------------------------------------------------------------- 1 | // 235 Lowest Common Ancestor of a Binary Search Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/二叉搜索树BST/669 Trim a Binary Search Tree.ts: -------------------------------------------------------------------------------- 1 | // 669 Trim a Binary Search Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/二叉搜索树BST/700 Search in a Binary Search Tree.ts: -------------------------------------------------------------------------------- 1 | // 700 Search in a Binary Search Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/1087 Brace Expansion.ts: -------------------------------------------------------------------------------- 1 | // 1087 Brace Expansion.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/1274 Number of Ships in a Rectangle.ts: -------------------------------------------------------------------------------- 1 | // 1274 Number of Ships in a Rectangle.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/1376 Time Needed to Inform All Employees.ts: -------------------------------------------------------------------------------- 1 | // 1376 Time Needed to Inform All Employees.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/212 Word Search II (I, II).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/DFS/图/212 Word Search II (I, II).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/341 Flatten Nested List Iterator (339 364).ts: -------------------------------------------------------------------------------- 1 | // 341 Flatten Nested List Iterator (339 364).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/399 Evaluate Division.ts: -------------------------------------------------------------------------------- 1 | // 399 Evaluate Division.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/586 Score of Parentheses.ts: -------------------------------------------------------------------------------- 1 | // 586 Score of Parentheses.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/图/694 Number of Distinct Islands.ts: -------------------------------------------------------------------------------- 1 | // 694 Number of Distinct Islands.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/排列组合/526 Beautiful Arrangement (similar to 46).ts: -------------------------------------------------------------------------------- 1 | // 526 Beautiful Arrangement (similar to 46).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/排列组合/698 Partition to K Equal Sum Subsets.ts: -------------------------------------------------------------------------------- 1 | // 698 Partition to K Equal Sum Subsets.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/1110 Delete Nodes And Return Forest.ts: -------------------------------------------------------------------------------- 1 | // 1110 Delete Nodes And Return Forest.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/1485 Clone Binary Tree With Random Pointer.ts: -------------------------------------------------------------------------------- 1 | // 1485 Clone Binary Tree With Random Pointer.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/226 Invert Binary Tree.ts: -------------------------------------------------------------------------------- 1 | // 226 Invert Binary Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/543 Diameter of Binary Tree.ts: -------------------------------------------------------------------------------- 1 | // 543 Diameter of Binary Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/572 Subtree of Another Tree.ts: -------------------------------------------------------------------------------- 1 | // 572 Subtree of Another Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/863 All Nodes Distance K in Binary Tree.ts: -------------------------------------------------------------------------------- 1 | // 863 All Nodes Distance K in Binary Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/951 Flip Equivalent Binary Trees.ts: -------------------------------------------------------------------------------- 1 | // 951 Flip Equivalent Binary Trees.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/树/987 Vertical Order Traversal of a Binary Tree.ts: -------------------------------------------------------------------------------- 1 | // 987 Vertical Order Traversal of a Binary Tree.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/记忆化搜索/1216 Valid Palindrome III.ts: -------------------------------------------------------------------------------- 1 | // 1216 Valid Palindrome III.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/记忆化搜索/1235 Maximum Profit in Job Scheduling.ts: -------------------------------------------------------------------------------- 1 | // 1235 Maximum Profit in Job Scheduling.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/记忆化搜索/1335 Minimum Difficulty of a Job Schedule.ts: -------------------------------------------------------------------------------- 1 | // 1335 Minimum Difficulty of a Job Schedule.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/记忆化搜索/329 Longest Increasing Path in a Matrix.ts: -------------------------------------------------------------------------------- 1 | // 329 Longest Increasing Path in a Matrix.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/记忆化搜索/377 Combination Sum IV.ts: -------------------------------------------------------------------------------- 1 | // 377 Combination Sum IV.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/记忆化搜索/403 Frog Jump.ts: -------------------------------------------------------------------------------- 1 | // 403 Frog Jump.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/DFS/记忆化搜索/472 Concatenated Words.ts: -------------------------------------------------------------------------------- 1 | // 472 Concatenated Words.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/1043 Partition Array for Maximum Sum.ts: -------------------------------------------------------------------------------- 1 | // 1043 Partition Array for Maximum Sum.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/1048 Longest String Chain.ts: -------------------------------------------------------------------------------- 1 | // 1048 Longest String Chain.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/1062 Longest Repeating Substring (dp 方法与 longest common substring 一致).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Dynamic Table/1062 Longest Repeating Substring (dp 方法与 longest common substring 一致).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/1140 Stone Game II.ts: -------------------------------------------------------------------------------- 1 | // 1140 Stone Game II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/1235 Maximum Profit in Job Scheduling (DP + binary search).ts: -------------------------------------------------------------------------------- 1 | // 1235 Maximum Profit in Job Scheduling (DP + binary search).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/1277 Count Square Submatrices with All Ones (可以使用 221 一样的解法).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Dynamic Table/1277 Count Square Submatrices with All Ones (可以使用 221 一样的解法).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/174 Dungeon Game.ts: -------------------------------------------------------------------------------- 1 | // 174 Dungeon Game.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/198 House Robber.ts: -------------------------------------------------------------------------------- 1 | // 198 House Robber.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/213 House Robber II.ts: -------------------------------------------------------------------------------- 1 | // 213 House Robber II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/32 Longest Valid Parentheses.ts: -------------------------------------------------------------------------------- 1 | // 32 Longest Valid Parentheses.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/322 Coin Change.ts: -------------------------------------------------------------------------------- 1 | // 322 Coin Change.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/354 Russian Doll Envelopes (接龙型 dp, 300 的 2D 版).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Dynamic Table/354 Russian Doll Envelopes (接龙型 dp, 300 的 2D 版).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/368 Largest Divisible Subset (接龙型 dp).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Dynamic Table/368 Largest Divisible Subset (接龙型 dp).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/518 Coin Change II (01 背包型).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Dynamic Table/518 Coin Change II (01 背包型).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/674 Longest Continuous Increasing Subsequence (接龙型 dp).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Dynamic Table/674 Longest Continuous Increasing Subsequence (接龙型 dp).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/70 Climbing Stairs.ts: -------------------------------------------------------------------------------- 1 | // 70 Climbing Stairs.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/712 Minimum ASCII Delete Sum for Two Strings.ts: -------------------------------------------------------------------------------- 1 | // 712 Minimum ASCII Delete Sum for Two Strings.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/718 Maximum Length of Repeated Subarray (和 1062 本质上一样).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Dynamic Table/718 Maximum Length of Repeated Subarray (和 1062 本质上一样).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Dynamic Table/740 Delete and Earn.ts: -------------------------------------------------------------------------------- 1 | // 740 Delete and Earn.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Hashmap/146. LRU Cache (Python 中可以使用 OrderedDict 来代替).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Hashmap/146. LRU Cache (Python 中可以使用 OrderedDict 来代替).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Hashmap/299. Bulls and Cows.ts: -------------------------------------------------------------------------------- 1 | // 299. Bulls and Cows.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Hashmap/348 Design Tic-Tac-Toe.ts: -------------------------------------------------------------------------------- 1 | // 348 Design Tic-Tac-Toe.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Heap/Priority Queue/1086. High Five.ts: -------------------------------------------------------------------------------- 1 | // 1086. High Five.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Heap/Priority Queue/1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit (这个题用单调双端队列、TreeMap、双 heap 都可以).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Heap/Priority Queue/1438. Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit (这个题用单调双端队列、TreeMap、双 heap 都可以).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Heap/Priority Queue/264. Ugly Number II.ts: -------------------------------------------------------------------------------- 1 | // 264. Ugly Number II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Heap/Priority Queue/378. Kth Smallest Element in a Sorted Matrix.ts: -------------------------------------------------------------------------------- 1 | // 378. Kth Smallest Element in a Sorted Matrix.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Heap/Priority Queue/895. Maximum Frequency Stack.ts: -------------------------------------------------------------------------------- 1 | // 895. Maximum Frequency Stack.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Monotone Stack (Queue)/503 Next Greater Element II.ts: -------------------------------------------------------------------------------- 1 | // 503 Next Greater Element II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Monotone Stack (Queue)/739 Daily Temperatures.ts: -------------------------------------------------------------------------------- 1 | // 739 Daily Temperatures.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Monotone Stack (Queue)/901 Online Stock Span.ts: -------------------------------------------------------------------------------- 1 | // 901 Online Stock Span.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Monotone Stack (Queue)/907 Sum of Subarray Minimums (与 84 类似).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Monotone Stack (Queue)/907 Sum of Subarray Minimums (与 84 类似).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Prefix Sum/1031 Maximum Sum of Two Non-Overlapping Subarrays.ts: -------------------------------------------------------------------------------- 1 | // 1031 Maximum Sum of Two Non-Overlapping Subarrays.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Prefix Sum/1423 Maximum Points You Can Obtain from Cards.ts: -------------------------------------------------------------------------------- 1 | // 1423 Maximum Points You Can Obtain from Cards.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Prefix Sum/304 Range Sum Query 2D - Immutable.ts: -------------------------------------------------------------------------------- 1 | // 304 Range Sum Query 2D - Immutable.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Prefix Sum/523 Continuous Subarray Sum.ts: -------------------------------------------------------------------------------- 1 | // 523 Continuous Subarray Sum.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Queue/1429. First Unique Number.ts: -------------------------------------------------------------------------------- 1 | // 1429. First Unique Number.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Queue/225. Implement Stack using Queues.ts: -------------------------------------------------------------------------------- 1 | // 225. Implement Stack using Queues.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Queue/281. Zigzag Iterator.ts: -------------------------------------------------------------------------------- 1 | // 281. Zigzag Iterator.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Queue/362. Design Hit Counte.ts: -------------------------------------------------------------------------------- 1 | // 362. Design Hit Counte.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Sort/179.Largest Number.ts: -------------------------------------------------------------------------------- 1 | //179.Largest Number.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Sort/27.Remove elements.ts: -------------------------------------------------------------------------------- 1 | //27.Remove elements.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Stack/1209. Remove All Adjacent Duplicates in String II.ts: -------------------------------------------------------------------------------- 1 | // 1209. Remove All Adjacent Duplicates in String II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Stack/1472. Design Browser History.ts: -------------------------------------------------------------------------------- 1 | // 1472. Design Browser History.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Stack/150. Evaluate Reverse Polish Notation.ts: -------------------------------------------------------------------------------- 1 | // 150. Evaluate Reverse Polish Notation.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Stack/232. Implement Queue using Stacks.ts: -------------------------------------------------------------------------------- 1 | // 232. Implement Queue using Stacks.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Stack/735. Asteroid Collisio.ts: -------------------------------------------------------------------------------- 1 | // 735. Asteroid Collisio.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Sweep Line/218 The Skyline Problem.ts: -------------------------------------------------------------------------------- 1 | // 218 The Skyline Problem.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Sweep Line/759 Employee Free Time.ts: -------------------------------------------------------------------------------- 1 | // 759 Employee Free Time.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/TreeMap/318 Count of Smaller Numbers After Self (这个题线段树、二分索引树、TreeMap 都可以).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/TreeMap/318 Count of Smaller Numbers After Self (这个题线段树、二分索引树、TreeMap 都可以).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/TreeMap/729 My Calendar I.ts: -------------------------------------------------------------------------------- 1 | // 729 My Calendar I.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/TreeMap/846 Hand of Straights.ts: -------------------------------------------------------------------------------- 1 | // 846 Hand of Straights.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/TreeMap/index.md: -------------------------------------------------------------------------------- 1 | 基础知识:基于红黑树(平衡二叉搜索树)的一种树状 hashmap,增删查改、找求大最小均为 logN 复杂度,Python 当中可以使用 SortedDict 替代;SortedDict 继承了普通的 dict 全部的方法,除此之外还可以 peekitem(k)来找 key 里面第 k 大的元素,popitem(k)来删除掉第 k 大的元素,弥补了 Python 自带的 heapq 没法 logN 时间复杂度内删除某个元素的缺陷;最近又在刷一些 hard 题目时候突然发现 TreeMap 简直是个神技,很多用别的数据结构写起来非常麻烦的题目,TreeMap 解决起来易如反掌。 2 | -------------------------------------------------------------------------------- /7.Canada Collections 110p/Trie 字典树/1268 Search Suggestions System.ts: -------------------------------------------------------------------------------- 1 | // 1268 Search Suggestions System.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Trie 字典树/212 Word Search II.ts: -------------------------------------------------------------------------------- 1 | // 212 Word Search II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/同向双指针 难/1004 Max Consecutive Ones II.ts: -------------------------------------------------------------------------------- 1 | // 1004 Max Consecutive Ones II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/同向双指针 难/340. Longest Substring with At Most K Distinct Characters.ts: -------------------------------------------------------------------------------- 1 | // 340. Longest Substring with At Most K Distinct Characters.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/同向双指针 难/424. Longest Repeating Character Replacement.ts: -------------------------------------------------------------------------------- 1 | // 424. Longest Repeating Character Replacement.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/相向双指针/1. Two Sum (这里使用的是先排序的双指针算法,不同于hashmap做法).ts: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/7.Canada Collections 110p/Two Pointers/相向双指针/1. Two Sum (这里使用的是先排序的双指针算法,不同于hashmap做法).ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/相向双指针/16. 3Sum Closest.ts: -------------------------------------------------------------------------------- 1 | // 16. 3Sum Closest.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/相向双指针/277. Find the Celebrity.ts: -------------------------------------------------------------------------------- 1 | // 277. Find the Celebrity.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/相向双指针/454. 4Sum II.ts: -------------------------------------------------------------------------------- 1 | // 454. 4Sum II.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Two Pointers/背向双指针/409. Longest Palindrome.ts: -------------------------------------------------------------------------------- 1 | // 409. Longest Palindrome.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Union Find/547 Number of Provinces.ts: -------------------------------------------------------------------------------- 1 | // 547 Number of Provinces.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Union Find/721 Accounts Merge.ts: -------------------------------------------------------------------------------- 1 | // 721 Accounts Merge.ts -------------------------------------------------------------------------------- /7.Canada Collections 110p/Union Find/737 Sentence Similarity II.ts: -------------------------------------------------------------------------------- 1 | // 737 Sentence Similarity II.ts -------------------------------------------------------------------------------- /8.Huahua-leetcode/1.Tree/144. Binary Tree Preorder Traversal.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | List arr; 3 | 4 | public List preorderTraversal(TreeNode root) { 5 | arr = new ArrayList(); 6 | traverse(root); 7 | return arr; 8 | } 9 | 10 | public void traverse(TreeNode root) { 11 | if (root == null) { 12 | return; 13 | } 14 | arr.add(root.val); 15 | traverse(root.left); 16 | traverse(root.right); 17 | } 18 | } -------------------------------------------------------------------------------- /8.Huahua-leetcode/1.Tree/145. Binary Tree Postorder Traversal.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | List arr; 3 | 4 | public List postorderTraversal(TreeNode root) { 5 | arr = new ArrayList(); 6 | traverse(root); 7 | return arr; 8 | } 9 | 10 | public void traverse(TreeNode root) { 11 | if (root == null) { 12 | return; 13 | } 14 | traverse(root.left); 15 | traverse(root.right); 16 | arr.add(root.val); 17 | } 18 | } -------------------------------------------------------------------------------- /8.Huahua-leetcode/1.Tree/429. N-ary Tree Level Order Traversal.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | private List> res = new ArrayList<>(); 3 | 4 | public List> levelOrder(Node root) { 5 | if (root != null) { 6 | traverse(root, 0); 7 | } 8 | return res; 9 | } 10 | 11 | public void traverse(Node node, Integer level) { 12 | if (res.size() <= level) { 13 | res.add(new ArrayList()); 14 | } 15 | res.get(level).add(node.val); 16 | for (Node item : node.children) { 17 | traverse(item, level + 1); 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /8.Huahua-leetcode/1.Tree/94. Binary Tree Inorder Traversal Problem.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | List arr; 3 | 4 | public List inorderTraversal(TreeNode root) { 5 | arr = new ArrayList(); 6 | traverse(root); 7 | return arr; 8 | } 9 | 10 | public void traverse(TreeNode root) { 11 | if (root == null) { 12 | return; 13 | } 14 | traverse(root.left); 15 | arr.add(root.val); 16 | traverse(root.right); 17 | } 18 | 19 | } -------------------------------------------------------------------------------- /8.Huahua-leetcode/1.Tree/test.java: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FleetingEcho/js-algorithm/9a47e1b27f6979197aa1c66fd1faef5de530eb30/8.Huahua-leetcode/1.Tree/test.java -------------------------------------------------------------------------------- /Algorithm-JS.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "js-algorithm", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "requires": true, 6 | "dependencies": { 7 | "typescript": { 8 | "version": "4.4.4", 9 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.4.4.tgz", 10 | "integrity": "sha512-DqGhF5IKoBl8WNf8C1gu8q0xZSInh9j1kJJMqT3a94w1JzVaBU4EXOSMrz9yDqMT0xt3selp83fuFMQ0uzv6qA==" 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2016", 4 | "module": "commonjs", 5 | "allowJs": true, 6 | "outDir": "./dist", 7 | "lib": ["ES2020", "dom", "dom.Iterable", "ES2016"], 8 | "rootDir": "./src", 9 | "strict": true, 10 | "strictNullChecks": true, 11 | "noFallthroughCasesInSwitch": true, 12 | "noImplicitThis": false, 13 | "moduleResolution": "Node", 14 | "forceConsistentCasingInFileNames": true 15 | } 16 | } 17 | --------------------------------------------------------------------------------