TypeScript / JavaScript 基础算法、数据结构练习,包含 LeetCode 或其它算法练习记录。
此为个人练习仓库,代码中对重要思想进行了注释,但是没有详细的解题思路后续会尽量补充解题思路。
每一道题都对应写有测试用例,但可能不够完整。如果您发现错误,欢迎给我留言,谢谢!
需安装 Node.js
v18.6.0+,yarn
1.22.x。
运行yarn
安装依赖,然后运行yarn start
可以自动从LeetCode获取代码函数和用例说明。保存文件后将自动同步到浏览器(比起VScode的LeetCode插件,此方法可以借助Wallaby获得更快和更友好的调试结果,支持Linux、MacOS、Windows)。
特别说明:部分题目截图仅为了方便在代码编辑器中直接预览从而优化编码体验,LeetCode题目以LeetCode官方页面为准,题目著作权及其他权利以LeetCode官方说明为准或属于LeetCode。已标注其来源的内容,版权均属于原作者。
请大家尊重版权,共同维护良好网络环境。
-
检查二进制字符串字段 [字符串]
- LeetCode 1784. 检查二进制字符串字段 https://leetcode.cn/problems/check-if-binary-string-has-at-most-one-segment-of-ones/
-
数组中的字符串匹配 [字符串, 字符串匹配]
- LeetCode 1408. 数组中的字符串匹配 https://leetcode.cn/problems/string-matching-in-an-array
-
生成每种字符都是奇数个的字符串 [字符串]
- LeetCode 1374. 生成每种字符都是奇数个的字符串 https://leetcode.cn/problems/generate-a-string-with-characters-that-have-odd-counts
-
- LeetCode 557. 反转字符串中的单词 III https://leetcode-cn.com/problems/reverse-words-in-a-string-iii/
- LintCode 1173. 反转字符串 III https://www.lintcode.com/problem/reverse-words-in-a-string-iii/description
-
- LeetCode 696. 计数二进制子串 https://leetcode-cn.com/problems/count-binary-substrings/
- LintCode 1079. 连续子串计数 https://www.lintcode.com/problem/count-binary-substrings/description
-
- LeetCode 459. 重复的子字符串 https://leetcode-cn.com/problems/repeated-substring-pattern/
- LintCode 1227. 重复的子串模式 https://www.lintcode.com/problem/repeated-substring-pattern/description
-
- LeetCode 10. 正则表达式匹配 https://leetcode-cn.com/problems/regular-expression-matching/
- LintCode 154. 正则表达式匹配 https://www.lintcode.com/problem/regular-expression-matching/description
-
- LeetCode 93. 复原 IP 地址 https://leetcode-cn.com/problems/restore-ip-addresses/
- LintCode 426. 恢复 IP 地址 https://www.lintcode.com/problem/restore-ip-addresses/description
-
- LeetCode 217. 存在重复元素 https://leetcode-cn.com/problems/contains-duplicate/
-
- LintCode 157. 判断字符串是否没有重复字符 https://www.lintcode.com/problem/unique-characters/description
-
- LintCode 55. 比较字符串 https://www.lintcode.com/problem/compare-strings/description
-
- LeetCode 3. 无重复字符的最长子串 https://leetcode-cn.com/problems/longest-substring-without-repeating-characters/
- LintCode 384. 最长无重复字符的子串 https://www.lintcode.com/problem/longest-substring-without-repeating-characters/description
-
- LeetCode 179. 最大数 https://leetcode-cn.com/problems/largest-number/
- LintCode 184. 最大数 https://www.lintcode.com/problem/largest-number/description
-
- 面试题参考思路,不严谨实现 廖雪峰 不要使用 JavaScript 内置的 parseInt()函数,利用 map 和 reduce 操作实现一个 string2int()函数。 https://www.liaoxuefeng.com/wiki/1022910821149312/1024322552460832
-
- LeetCode 面试题 58 - II. 左旋转字符串 https://leetcode-cn.com/problems/zuo-xuan-zhuan-zi-fu-chuan-lcof/
-
- LeetCode 58. 最后一个单词的长度 https://leetcode-cn.com/problems/length-of-last-word/
- LintCode 422. 最后一个单词的长度 https://www.lintcode.com/problem/length-of-last-word/description
-
- LeetCode 12. 整数转罗马数字 https://leetcode-cn.com/problems/integer-to-roman/
- LintCode 418. 整数转罗马数字 https://www.lintcode.com/problem/integer-to-roman/description
-
- LeetCode 13. 罗马数字转整数 https://leetcode-cn.com/problems/roman-to-integer/
- LintCode 419. 罗马数字转整数 https://www.lintcode.com/problem/roman-to-integer/description
-
- LeetCode 680. 验证回文字符串 Ⅱ https://leetcode-cn.com/problems/valid-palindrome-ii/
- LintCode 891. 有效回文 II https://www.lintcode.com/problem/valid-palindrome-ii/description
-
- LeetCode 1108. IP 地址无效化 https://leetcode-cn.com/problems/defanging-an-ip-address/
-
- LeetCode 5. 最长回文子串 https://leetcode-cn.com/problems/longest-palindromic-substring/
- LintCode 200. 最长回文子串 https://www.lintcode.com/problem/longest-palindromic-substring/
-
- LeetCode 1371. 每个元音包含偶数次的最长子字符串 https://leetcode-cn.com/problems/find-the-longest-substring-containing-vowels-in-even-counts/
-
- LeetCode 76. 最小覆盖子串 https://leetcode-cn.com/problems/minimum-window-substring/
- LintCode 32. 最小子串覆盖 https://www.lintcode.com/problem/minimum-window-substring/description
-
- LeetCode 5416. 检查单词是否为句中其他单词的前缀 https://leetcode-cn.com/problems/check-if-a-word-occurs-as-a-prefix-of-any-word-in-a-sentence/
-
- LeetCode 5417. 定长子串中元音的最大数目 https://leetcode-cn.com/problems/maximum-number-of-vowels-in-a-substring-of-given-length/
-
- LeetCode 14. 最长公共前缀 https://leetcode-cn.com/problems/longest-common-prefix/
- LintCode 78. 最长公共前缀 https://www.lintcode.com/problem/longest-common-prefix/description
-
- LeetCode 22. 括号生成 https://leetcode.cn/problems/generate-parentheses/
-
- LeetCode 241. 为运算表达式设计优先级 https://leetcode.cn/problems/different-ways-to-add-parentheses/
-
打家劫舍 [数组, 动态规划]
- LeetCode 198. 打家劫舍 https://leetcode.cn/problems/house-robber
-
水果成篮 [数组, 哈希表, 滑动窗口]
- LeetCode 904. 水果成篮 https://leetcode.cn/problems/fruit-into-baskets
-
最短单词距离 [数组, 字符串]
- LeetCode 243. 最短单词距离 https://leetcode.cn/problems/shortest-word-distance/
-
拆炸弹 [数组]
- LeetCode 1652. 拆炸弹 https://leetcode.cn/problems/defuse-the-bomb
-
统计好三元组 [数组, 枚举]
- LeetCode 1534. 统计好三元组 https://leetcode.cn/problems/count-good-triplets/
-
雇佣 K 名工人的最低成本 [贪心, 数组, 排序, 堆(优先队列)]
- LeetCode 857. 雇佣 K 名工人的最低成本 https://leetcode.cn/problems/minimum-cost-to-hire-k-workers
-
螺旋矩阵 [数组, 矩阵, 模拟]
- LeetCode 54. 螺旋矩阵 https://leetcode.cn/problems/spiral-matrix/
-
二进制矩阵中的特殊位置 [数组, 矩阵]
- LeetCode 1582. 二进制矩阵中的特殊位置 https://leetcode.cn/problems/special-positions-in-a-binary-matrix
-
最长数对链 [贪心, 数组, 动态规划, 排序]
- LeetCode 646. 最长数对链 https://leetcode.cn/problems/maximum-length-of-pair-chain
-
公交站间的距离 [数组]
- LeetCode 1184. 公交站间的距离 https://leetcode.cn/problems/distance-between-bus-stops
-
存在重复元素 III [数组, 桶排序, 有序集合, 排序, 滑动窗口]
- LeetCode 220. 存在重复元素 III https://leetcode.cn/problems/contains-duplicate-iii/
-
回旋镖的数量 [数组, 哈希表, 数学]
- LeetCode 447. 回旋镖的数量 https://leetcode.cn/problems/number-of-boomerangs/
-
四数相加 II [数组, 哈希表]
- LeetCode 454. 四数相加 II https://leetcode.cn/problems/4sum-ii/
-
有序转化数组 [数组, 数学, 双指针, 排序]
- LeetCode 360. 有序转化数组 https://leetcode.cn/problems/sort-transformed-array/
-
- LeetCode 17. 电话号码的字母组合 https://leetcode-cn.com/problems/letter-combinations-of-a-phone-number/
- LintCode 425. 电话号码的字母组合 https://www.lintcode.com/problem/letter-combinations-of-a-phone-number/description
-
- LeetCode 914. 卡牌分组 https://leetcode-cn.com/problems/x-of-a-kind-in-a-deck-of-cards/
-
- LeetCode 26. 删除排序数组中的重复项 https://leetcode-cn.com/problems/remove-duplicates-from-sorted-array/
- LintCode 100. 删除排序数组中的重复数字 https://www.lintcode.com/problem/remove-duplicates-from-sorted-array/description
-
- LeetCode 605. 种花问题 https://leetcode-cn.com/problems/can-place-flowers/
- LintCode 1138. 能否放置花 https://www.lintcode.com/problem/can-place-flowers/description
-
-
假设有一个升序数组,经过不确定长度的偏移,得到一个新的数组,我们称为循环升序数组。 (例如:[0, 3, 4, 6, 7] 可能变成 [6, 7, 0, 3, 4]) 给定一个数字和一个循环升序数组,判断这个数字是否在这个数组内,在的话返回 true,否则返回 false。要求时间复杂度为 O(logN)
示例 1: 输入:nums = [6, 7, 0, 3, 4], target = 0 输出:true
示例 2: 输入:nums = [6, 7, 0, 3, 4], target = 5 输出:false
-
-
- LeetCode 457. 环形数组循环 https://leetcode-cn.com/problems/circular-array-loop/
- LintCode 1229. 循环数组中的环 https://www.lintcode.com/problem/circular-array-loop/description
-
- LeetCode 89. 格雷编码 https://leetcode-cn.com/problems/gray-code/
- LintCode 411. 格雷编码 https://www.lintcode.com/problem/gray-code/description
-
- LintCode 31. 数组划分 https://www.lintcode.com/problem/partition-array/description
-
- LeetCode 922. 按奇偶排序数组 II https://leetcode-cn.com/problems/sort-array-by-parity-ii/
-
- LeetCode 215. 数组中的第 K 个最大元素 https://leetcode-cn.com/problems/kth-largest-element-in-an-array/
- LeetCode 414. 第三大的数【相似,需去重】 https://leetcode-cn.com/problems/third-maximum-number/submissions/
- LintCode 5. 第 k 大元素 https://www.lintcode.com/problem/kth-largest-element/description
- LintCode 606. 第 K 大的元素 II https://www.lintcode.com/problem/kth-largest-element-ii/description
- LintCode 544. 前 K 大数【相似】 https://www.lintcode.com/problem/top-k-largest-numbers/description
- LintCode 479. 数组第二大数【相似】 https://www.lintcode.com/problem/second-max-of-array/description
-
- LeetCode 164. 最大间距 https://leetcode-cn.com/problems/maximum-gap/
- LintCode 400. 最大间距 https://www.lintcode.com/problem/maximum-gap/
-
- LeetCode 41. 缺失的第一个正数 https://leetcode-cn.com/problems/first-missing-positive/
- LintCode 189. 丢失的第一个正整数 https://www.lintcode.com/problem/first-missing-positive/description
- LintCode 681. 缺失的第一个素数【相似】 https://www.lintcode.com/problem/first-missing-prime-number/description
-
- LintCode 681. 缺失的第一个素数 https://www.lintcode.com/problem/first-missing-prime-number/description
-
- LeetCode 30. 串联所有单词的子串 https://leetcode-cn.com/problems/substring-with-concatenation-of-all-words/
- LintCode 1362. 包含所有单词连接的子串 https://www.lintcode.com/problem/substring-with-concatenation-of-all-words/description
-
- LeetCode 122. 买卖股票的最佳时机 II https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-ii/
- LintCode 150. 买卖股票的最佳时机 II https://www.lintcode.com/problem/best-time-to-buy-and-sell-stock-ii/description
-
- LeetCode 35. 搜索插入位置 https://leetcode-cn.com/problems/search-insert-position/
- LintCode 20. 搜索插入位置 https://www.lintcode.com/problem/search-insert-position/description
-
- LeetCode 35. 二分查找 https://leetcode-cn.com/problems/binary-search/
- LintCode 20. 二分查找 https://www.lintcode.com/problem/first-position-of-target/description
-
- LeetCode 1002. 查找常用字符 https://leetcode-cn.com/problems/find-common-characters/
-
- LeetCode 542. 01 矩阵 https://leetcode-cn.com/problems/01-matrix/
- LintCode 974. 01 矩阵 https://www.lintcode.com/problem/01-matrix/description
-
- LeetCode 56. 合并区间 https://leetcode-cn.com/problems/merge-intervals/
- LintCode 156. 合并区间 https://www.lintcode.com/problem/merge-intervals/description
-
- LeetCode 55. 跳跃游戏 https://leetcode-cn.com/problems/jump-game/
- LintCode 116. 跳跃游戏 https://www.lintcode.com/problem/jump-game/description
-
- LeetCode 11. 盛最多水的容器 https://leetcode-cn.com/problems/container-with-most-water/
- LintCode 383. 装最多水的容器 https://www.lintcode.com/problem/container-with-most-water/description
-
- LeetCode 466. 统计重复个数 https://leetcode-cn.com/problems/count-the-repetitions/
- LintCode 1224. 统计重复个数 https://www.lintcode.com/problem/count-the-repetitions/description
-
- LeetCode 200. 岛屿数量 https://leetcode-cn.com/problems/number-of-islands/
- LintCode 433. 岛屿的个数 https://www.lintcode.com/problem/number-of-islands/description
-
- LeetCode 1248. 统计「优美子数组」 https://leetcode-cn.com/problems/count-number-of-nice-subarrays/
-
- LeetCode 面试题 17.10. 主要元素 https://leetcode-cn.com/problems/find-majority-element-lcci/
- LintCode 46. 主元素 https://www.lintcode.com/problem/majority-element/description
-
- LeetCode 面试题 51. 数组中的逆序对 https://leetcode-cn.com/problems/shu-zu-zhong-de-ni-xu-dui-lcof/
- LintCode 532. 逆序对 https://www.lintcode.com/problem/reverse-pairs/description
-
- LeetCode 33. 搜索旋转排序数组 https://leetcode-cn.com/problems/search-in-rotated-sorted-array/
- LintCode 62. 搜索旋转排序数组 https://www.lintcode.com/problem/search-in-rotated-sorted-array/description
-
- LeetCode 面试题 56 - I. 数组中数字出现的次数 https://leetcode-cn.com/problems/shu-zu-zhong-shu-zi-chu-xian-de-ci-shu-lcof/
-
- LeetCode 136. 只出现一次的数字 https://leetcode-cn.com/problems/single-number/
-
- LeetCode 1095. 山脉数组中查找目标值 https://leetcode-cn.com/problems/find-in-mountain-array/
- LeetCode 852. 山脉数组的峰顶索引 https://leetcode-cn.com/problems/peak-index-in-a-mountain-array/
- LintCode 585. 山脉序列中的最大值 https://www.lintcode.com/problem/maximum-number-in-mountain-sequence/description
-
- LeetCode 202. 快乐数 https://leetcode-cn.com/problems/happy-number/
- LintCode 488. 快乐数 https://www.lintcode.com/problem/happy-number/description
-
- LeetCode 53. 最大子序和 https://leetcode-cn.com/problems/maximum-subarray/
- LeetCode 面试题 42. 连续子数组的最大和 https://leetcode-cn.com/problems/lian-xu-zi-shu-zu-de-zui-da-he-lcof/
- LintCode 41. 最大子数组 https://www.lintcode.com/problem/maximum-subarray/description
-
- LeetCode 45. 跳跃游戏 II https://leetcode-cn.com/problems/jump-game-ii/
- LintCode 117. 跳跃游戏 II https://www.lintcode.com/problem/jump-game-ii/description
-
- LintCode 770. 最大数和最小数 https://www.lintcode.com/problem/maximum-and-minimum/description
-
- LeetCode 983. 最低票价 https://leetcode-cn.com/problems/minimum-cost-for-tickets/
-
- LeetCode 221. 最大正方形 https://leetcode-cn.com/problems/maximal-square/
- LintCode 436. 最大正方形 https://www.lintcode.com/problem/maximal-square/description
-
- LintCode 685. 数据流中第一个唯一的数字 https://www.lintcode.com/problem/first-unique-number-in-data-stream/description
-
- LeetCode 面试题 50. 第一个只出现一次的字符 https://leetcode-cn.com/problems/di-yi-ge-zhi-chu-xian-yi-ci-de-zi-fu-lcof/
- LeetCode 387. 字符串中的第一个唯一字符 https://leetcode-cn.com/problems/first-unique-character-in-a-string/
- LintCode 209. 第一个只出现一次的字符 https://www.lintcode.com/problem/first-unique-character-in-a-string/description
-
- LeetCode 152. 乘积最大子数组 https://leetcode-cn.com/problems/maximum-product-subarray/
- LintCode 191. 乘积最大子序列 https://www.lintcode.com/problem/maximum-product-subarray/description
-
- LintCode 1613. 最高频率的 IP https://www.lintcode.com/problem/highest-frequency-ip/description
-
- LeetCode 860. 柠檬水找零 https://leetcode-cn.com/problems/lemonade-change/
- LintCode 1509. 柠檬水找零 https://www.lintcode.com/problem/lemonade-change/description
-
- LeetCode 146. LRU 缓存机制 https://leetcode-cn.com/problems/lru-cache/
- LintCode 134. LRU 缓存策略 https://www.lintcode.com/problem/lru-cache/description
-
- LeetCode 287. 寻找重复数 https://leetcode-cn.com/problems/find-the-duplicate-number/
- LintCode 633. 寻找重复的数 https://www.lintcode.com/problem/find-the-duplicate-number/description
-
- LeetCode 974. 和可被 K 整除的子数组 https://leetcode-cn.com/problems/subarray-sums-divisible-by-k/
-
- LeetCode 198. 打家劫舍 https://leetcode-cn.com/problems/house-robber/
- LintCode 392. 打劫房屋 https://www.lintcode.com/problem/house-robber/description
-
- LeetCode 1431. 拥有最多糖果的孩子 https://leetcode-cn.com/problems/kids-with-the-greatest-number-of-candies/
-
- LeetCode 238. 除自身以外数组的乘积 https://leetcode-cn.com/problems/product-of-array-except-self/
- LintCode 1310. 数组除了自身的乘积 https://www.lintcode.com/problem/product-of-array-except-self/description
-
- LeetCode 739. 每日温度 https://leetcode-cn.com/problems/daily-temperatures/
- LintCode 1060. 每日温度 https://www.lintcode.com/problem/daily-temperatures/description
-
- LeetCode 718. 最长重复子数组 https://leetcode-cn.com/problems/maximum-length-of-repeated-subarray/
- LintCode 79. 最长公共子串 https://www.lintcode.com/problem/longest-common-substring/description
-
- LeetCode 378. 有序矩阵中第 K 小的元素 https://leetcode-cn.com/problems/kth-smallest-element-in-a-sorted-matrix/
- LintCode 401. 排序矩阵中的从小到大第 k 个数 https://www.lintcode.com/problem/kth-smallest-number-in-sorted-matrix/description
-
- LeetCode 710. 黑名单中的随机数 https://leetcode.cn/problems/random-pick-with-blacklist/
-
- LeetCode 6. Z 字形变换 https://leetcode.cn/problems/zigzag-conversion/
-
- LeetCode 522. 最长特殊序列 II https://leetcode.cn/problems/longest-uncommon-subsequence-ii/
-
- LeetCode 324. 摆动排序 II https://leetcode.cn/problems/wiggle-sort-ii/
-
- LeetCode 189. 轮转数组 https://leetcode.cn/problems/rotate-array/
-
餐盘栈 [栈, 设计, 哈希表, 堆(优先队列)]
- LeetCode 1172. 餐盘栈 https://leetcode.cn/problems/dinner-plate-stacks
-
用栈操作构建数组 [栈, 数组, 模拟]
- LeetCode 1441. 用栈操作构建数组 https://leetcode.cn/problems/build-an-array-with-stack-operations
-
简化路径 [栈, 字符串]
- LeetCode 71. 简化路径 https://leetcode.cn/problems/simplify-path/
-
- LeetCode 85. 最大矩阵 https://leetcode-cn.com/problems/maximal-rectangle/
- LintCode 510. 最大矩阵 https://www.lintcode.com/problem/maximal-rectangle/description
-
- LeetCode 155. 最小栈 https://leetcode-cn.com/problems/min-stack/
- LintCode 12. 带最小值操作的栈 https://www.lintcode.com/problem/min-stack/description
-
- LeetCode 剑指 Offer 09. 用两个栈实现队列 https://leetcode-cn.com/problems/yong-liang-ge-zhan-shi-xian-dui-lie-lcof/
-
- LeetCode 394. 字符串解码 https://leetcode-cn.com/problems/decode-string/
- LintCode 575. 字符串解码 https://www.lintcode.com/problem/decode-string/description
-
直线上最多的点数 [几何, 数组, 哈希表, 数学]
- LeetCode 149. 直线上最多的点数 https://leetcode.cn/problems/max-points-on-a-line/
-
丑数 [数学]
- LeetCode 263. 丑数 https://leetcode.cn/problems/ugly-number/
-
下一个更大元素 III [数学, 双指针, 字符串]
- LeetCode 556. 下一个更大元素 III https://leetcode.cn/problems/next-greater-element-iii
-
- LeetCode 172. 阶乘后的零 https://leetcode-cn.com/problems/factorial-trailing-zeroes/submissions/
- LintCode 2. 尾部的零 https://www.lintcode.com/problem/trailing-zeros/description
-
- LeetCode 264. 丑数 II https://leetcode-cn.com/problems/ugly-number-ii/
- LintCode 4. 丑数 II https://www.lintcode.com/problem/ugly-number-ii/description
-
- LeetCode 面试题 08.11. 硬币 https://leetcode-cn.com/problems/coin-lcci/
-
- LeetCode 46. 全排列 https://leetcode-cn.com/problems/permutations/
- LintCode 15. 全排列 https://www.lintcode.com/problem/permutations/description
-
- LeetCode 面试题 16.07. 最大数值 https://leetcode-cn.com/problems/maximum-lcci/
-
- LeetCode 9. 回文数 https://leetcode-cn.com/problems/palindrome-number/
- LintCode 491. 回文数 https://www.lintcode.com/problem/palindrome-number/description
-
- LeetCode 50. Pow(x, n) https://leetcode-cn.com/problems/powx-n/
- LintCode 428. x 的 n 次幂 https://www.lintcode.com/problem/powx-n/description
-
- LeetCode 560. 和为 K 的子数组 https://leetcode-cn.com/problems/subarray-sum-equals-k/
- LintCode 838. 子数组和为 K https://www.lintcode.com/problem/subarray-sum-equals-k/description
-
- LeetCode 507. 完美数 https://leetcode-cn.com/problems/perfect-number/
- LintCode 1199. 完美的数 https://www.lintcode.com/problem/perfect-number/description
-
- LeetCode 4. 寻找两个正序数组的中位数 https://leetcode-cn.com/problems/median-of-two-sorted-arrays/
- LintCode 65. 两个排序数组的中位数 https://www.lintcode.com/problem/median-of-two-sorted-arrays/description
-
- LeetCode 15. 三数之和 https://leetcode-cn.com/problems/3sum/
- LintCode 57. 三数之和 https://www.lintcode.com/problem/3sum/description
-
- LeetCode 67. 二进制求和 https://leetcode-cn.com/problems/add-binary/
- LintCode 408. 二进制求和 https://www.lintcode.com/problem/add-binary/description
-
- LeetCode 16. 最接近的三数之和 https://leetcode.cn/problems/3sum-closest/
-
- LeetCode 18. 四数之和 https://leetcode.cn/problems/4sum/
-
超级丑数 [数组, 数学, 动态规划]
- LeetCode 313. 超级丑数 https://leetcode-cn.com/problems/super-ugly-number/
- LintCode 518. 超级丑数 https://www.lintcode.com/problem/super-ugly-number/description
-
修剪二叉搜索树 [树, 深度优先搜索, 二叉搜索树, 二叉树]
- LeetCode 669. 修剪二叉搜索树 https://leetcode.cn/problems/trim-a-binary-search-tree
-
相同的树 [树, 深度优先搜索, 广度优先搜索, 二叉树]
- LeetCode 100. 相同的树 https://leetcode.cn/problems/same-tree/
-
我的日程安排表 I [设计, 线段树, 二分查找, 有序集合]
- LeetCode 729. 我的日程安排表 I https://leetcode.cn/problems/my-calendar-i
-
- LeetCode 199. 二叉树的右视图 https://leetcode-cn.com/problems/binary-tree-right-side-view/
- LintCode 760. 二叉树的右视图 https://www.lintcode.com/problem/binary-tree-right-side-view/description
-
- LeetCode 98. 验证二叉搜索树 https://leetcode-cn.com/problems/validate-binary-search-tree/
- LintCode 95. 验证二叉查找树 https://www.lintcode.com/problem/validate-binary-search-tree/description
-
- LeetCode 236. 二叉树的最近公共祖先 https://leetcode-cn.com/problems/lowest-common-ancestor-of-a-binary-tree/
- LintCode 88. 最近公共祖先 https://www.lintcode.com/problem/lowest-common-ancestor-of-a-binary-tree/description
-
- LeetCode 572. 另一个树的子树 https://leetcode-cn.com/problems/subtree-of-another-tree/
- LintCode 1165. 另一个树的子树 https://www.lintcode.com/problem/subtree-of-another-tree/description
-
- LeetCode 102. 二叉树的层序遍历 https://leetcode-cn.com/problems/binary-tree-level-order-traversal/
- LintCode 69. 二叉树的层次遍历 https://www.lintcode.com/problem/binary-tree-level-order-traversal/description
-
- LeetCode 107. 二叉树的层次遍历 II https://leetcode-cn.com/problems/binary-tree-level-order-traversal-ii/
- LintCode 70. 二叉树的层次遍历 II https://www.lintcode.com/problem/binary-tree-level-order-traversal-ii/description
-
- LeetCode 105. 从前序与中序遍历序列构造二叉树 https://leetcode-cn.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal/
- LintCode 73. 前序遍历和中序遍历树构造二叉树 https://www.lintcode.com/problem/construct-binary-tree-from-preorder-and-inorder-traversal/description
-
- LeetCode 108. 将有序数组转换为二叉搜索树 https://leetcode-cn.com/problems/convert-sorted-array-to-binary-search-tree/
- LintCode 106. 有序链表转换为二叉搜索树 https://www.lintcode.com/problem/convert-sorted-list-to-binary-search-tree/description
-
- LeetCode 96. 不同的二叉搜索树 https://leetcode-cn.com/problems/unique-binary-search-trees/
-
删除链表中的节点 [链表]
- LeetCode 237. 删除链表中的节点 https://leetcode.cn/problems/delete-node-in-a-linked-list/
-
反转链表 [递归, 链表]
- LeetCode 206. 反转链表 https://leetcode.cn/problems/reverse-linked-list/
-
- LeetCode 23. 合并 K 个排序链表 https://leetcode-cn.com/problems/merge-k-sorted-lists/
- LintCode 104. 合并 k 个排序链表 https://www.lintcode.com/problem/merge-k-sorted-lists/description
-
- LeetCode 21. 合并两个有序链表 https://leetcode-cn.com/problems/merge-two-sorted-lists/
- LeetCode 面试题 25. 合并两个排序的链表 https://leetcode-cn.com/problems/he-bing-liang-ge-pai-xu-de-lian-biao-lcof
- LintCode 165. 合并两个排序链表 https://www.lintcode.com/problem/merge-two-sorted-lists/description
-
- LeetCode 148. 排序链表 https://leetcode-cn.com/problems/sort-list/
- LintCode 98. 链表排序 https://www.lintcode.com/problem/sort-list/description
-
- LeetCode 141. 环形链表 https://leetcode-cn.com/problems/linked-list-cycle/
- LintCode 102. 带环链表 https://www.lintcode.com/problem/linked-list-cycle/description
-
- LeetCode 876. 链表的中间结点 https://leetcode-cn.com/problems/middle-of-the-linked-list/
- LintCode 1609. 链表的中间结点 https://www.lintcode.com/problem/middle-of-the-linked-list/description
-
- LeetCode 25. K 个一组翻转链表 https://leetcode-cn.com/problems/reverse-nodes-in-k-group/
- LintCode 450. K 组翻转链表 https://www.lintcode.com/problem/reverse-nodes-in-k-group/description
-
- LeetCode 24. 两两交换链表中的节点 https://leetcode.cn/problems/swap-nodes-in-pairs/
-
最小化旅行的价格总和 [树, 深度优先搜索, 图, 数组, 动态规划]
- LeetCode 2646. 最小化旅行的价格总和 https://leetcode.cn/problems/minimize-the-total-price-of-the-trips
-
可能的二分法 [深度优先搜索, 广度优先搜索, 并查集, 图]
- LeetCode 886. 可能的二分法 https://leetcode.cn/problems/possible-bipartition
-
找到小镇的法官 [图, 数组, 哈希表]
- LeetCode 997. 找到小镇的法官 https://leetcode.cn/problems/find-the-town-judge
-
- LeetCode 210. 课程表 II https://leetcode-cn.com/problems/course-schedule-ii/
- LeetCode 207. 课程表 https://leetcode-cn.com/problems/course-schedule/
- LintCode 615. 课程表 https://www.lintcode.com/problem/course-schedule/description
-
最小绝对差 [数组, 排序]
- LeetCode 1200. 最小绝对差 https://leetcode.cn/problems/minimum-absolute-difference
-
删除字符使频率相同 [哈希表, 字符串, 计数]
- LeetCode 2423. 删除字符使频率相同 https://leetcode.cn/problems/remove-letter-to-equalize-frequency
-
仅执行一次字符串交换能否使两个字符串相等 [哈希表, 字符串, 计数]
- LeetCode 1790. 仅执行一次字符串交换能否使两个字符串相等 https://leetcode.cn/problems/check-if-one-string-swap-can-make-strings-equal
-
至多包含 K 个不同字符的最长子串 [哈希表, 字符串, 滑动窗口]
- LeetCode 340. 至多包含 K 个不同字符的最长子串 https://leetcode.cn/problems/longest-substring-with-at-most-k-distinct-characters/
-
两个相同字符之间的最长子字符串 [哈希表, 字符串]
- LeetCode 1624. 两个相同字符之间的最长子字符串 https://leetcode.cn/problems/largest-substring-between-two-equal-characters
-
数组嵌套 [深度优先搜索, 数组]
- LeetCode 565. 数组嵌套 https://leetcode.cn/problems/array-nesting