/LeetCode-Solutions-in-Cpp17

基于C++17的LeetCode题解

Primary LanguageC++MIT LicenseMIT

Category

Tag 中文站 Category
Top Interview Questions-Easy Collection 初级算法 Reference
Top Interview Questions-Medium Collection 中级算法 Reference
Top Interview Questions-Hard Collection 高级算法 Reference
Concurrency 多线程 Reference

Problem

# Title 中文站 Solution Code
0001 Two Sum 两数之和 README C++
0002 Add Two Numbers 两数相加 README C++
0003 Longest Substring Without Repeating Characters 无重复字符的最长子串 README C++
0004 Median of Two Sorted Arrays 寻找两个有序数组的中位数 README C++
0005 Longest Palindromic Substring 最长回文子串 README C++
0007 Reverse Integer 整数反转 README C++
0008 String to Integer (atoi) 字符串转换整数 (atoi) README C++
0010 Regular Expression Matching 正则表达式匹配 README C++
0011 Container With Most Water 盛最多水的容器 README C++
0013 Roman to Integer 罗马数字转整数 README C++
0014 Longest Common Prefix 最长公共前缀 README C++
0015 3Sum 三数之和 README C++
0017 Letter Combinations of a Phone Number 电话号码的字母组合 README C++
0019 Remove Nth Node From End of List 删除链表的倒数第N个节点 README C++
0020 Valid Parentheses 有效的括号 README C++
0021 Merge Two Sorted Lists 合并两个有序链表 README C++
0022 Generate Parentheses 括号生成 README C++
0023 Merge k Sorted Lists 合并K个排序链表 README C++
0026 Remove Duplicates from Sorted Array 删除排序数组中的重复项 README C++
0028 Implement strStr() 实现 strStr() README C++
0029 Divide Two Integers 两数相除 README C++
0031 Next Permutation 下一个排列 README C++
0032 Longest Valid Parentheses 最长有效括号 README C++
0033 Search in Rotated Sorted Array 搜索旋转排序数组 README C++
0034 Find First and Last Position of Element in Sorted Array 在排序数组中查找元素的第一个和最后一个位置 README C++
0036 Valid Sudoku 有效的数独 README C++
0038 Count and Say 外观数列 README C++
0039 Combination Sum 组合总和 README C++
0041 First Missing Positive 缺失的第一个正数 README C++
0042 Trapping Rain Water 接雨水 README C++
0044 Wildcard Matching 通配符匹配 README C++
0046 Permutations 全排列 README C++
0048 Rotate Image 旋转图像 README C++
0049 Group Anagrams 字母异位词分组 README C++
0050 Pow(x, n) Pow(x, n) README C++
0051 N-Queens N皇后 README C++
0053 Maximum Subarray 最大子序和 README C++
0054 Spiral Matrix 螺旋矩阵 README C++
0055 Jump Game 跳跃游戏 README C++
0056 Merge Intervals 合并区间 README C++
0062 Unique Paths 不同路径 README C++
0066 Plus One 加一 README C++
0069 Sqrt(x) x 的平方根 README C++
0070 Climbing Stairs 爬楼梯 README C++
0072 Edit Distance 编辑距离 README C++
0073 Set Matrix Zeroes 矩阵置零 README C++
0075 Sort Colors 颜色分类 README C++
0076 Minimum Window Substring 最小覆盖子串 README C++
0078 Subsets 子集 README C++
0079 Word Search 单词搜索 README C++
0084 Largest Rectangle in Histogram 柱状图中最大的矩形 README C++
0085 Maximal Rectangle 最大矩形 README C++
0088 Merge Sorted Array 合并两个有序数组 README C++
0094 Binary Tree Inorder Traversal 二叉树的中序遍历 README C++
0096 Unique Binary Search Trees 不同的二叉搜索树 README C++
0098 Validate Binary Search Tree 验证二叉搜索树 README C++
0101 Symmetric Tree 对称二叉树 README C++
0102 Binary Tree Level Order Traversal 二叉树的层序遍历 README C++
0103 Binary Tree Zigzag Level Order Traversal 二叉树的锯齿形层次遍历 README C++
0104 Maximum Depth of Binary Tree 二叉树的最大深度 README C++
0105 Construct Binary Tree from Preorder and Inorder Traversal 从前序与中序遍历序列构造二叉树 README C++
0106 Construct Binary Tree from Inorder and Postorder Traversal 从中序与后序遍历序列构造二叉树 README C++
0108 Convert Sorted Array to Binary Search Tree 将有序数组转换为二叉搜索树 README C++
0114 Flatten Binary Tree to Linked List 二叉树展开为链表 README C++
0116 Populating Next Right Pointers in Each Node 填充每个节点的下一个右侧节点指针 README C++
0118 Pascal's Triangle 杨辉三角 README C++
0121 Best Time to Buy and Sell Stock 买卖股票的最佳时机 README C++
0122 Best Time to Buy and Sell Stock II 买卖股票的最佳时机 II README C++
0124 Binary Tree Maximum Path Sum 二叉树中的最大路径和 README C++
0125 Valid Palindrome 验证回文串 README C++
0127 Word Ladder 单词接龙 README C++
0128 Longest Consecutive Sequence 最长连续序列 README C++
0130 Surrounded Regions 被围绕的区域 README C++
0131 Palindrome Partitioning 分割回文串 README C++
0134 Gas Station 加油站 README C++
0136 Single Number 只出现一次的数字 README C++
0138 Copy List with Random Pointer 复制带随机指针的链表 README C++
0139 Word Break 单词拆分 README C++
0140 Word Break II 单词拆分 II README C++
0141 Linked List Cycle 环形链表 README C++
0144 Binary Tree Preorder Traversal 二叉树的前序遍历 README C++
0145 Binary Tree Postorder Traversal 二叉树的后序遍历 README C++
0146 LRU Cache LRU缓存机制 README C++
0148 Sort List 排序链表 README C++
0149 Max Points on a Line 直线上最多的点数 README C++
0150 Evaluate Reverse Polish Notation 逆波兰表达式求值 README C++
0152 Maximum Product Subarray 乘积最大子数组 README C++
0155 Min Stack 最小栈 README C++
0160 Intersection of Two Linked Lists 相交链表 README C++
0162 Find Peak Element 寻找峰值 README C++
0166 Fraction to Recurring Decimal 分数到小数 README C++
0169 Majority Element 多数元素 README C++
0171 Excel Sheet Column Number Excel表列序号 README C++
0172 Factorial Trailing Zeroes 阶乘后的零 README C++
0173 Binary Search Tree Iterator 二叉搜索树迭代器 README C++
0179 Largest Number 最大数 README C++
0189 Rotate Array 旋转数组 README C++
0190 Reverse Bits 颠倒二进制位 README C++
0191 Number of 1 Bits 位1的个数 README C++
0198 House Robber 打家劫舍 README C++
0200 Number of Islands 岛屿数量 README C++
0202 Happy Number 快乐数 README C++
0204 Count Primes 计数质数 README C++
0206 Reverse Linked List 反转链表 README C++
0207 Course Schedule 课程表 README C++
0208 Implement Trie (Prefix Tree) 实现 Trie (前缀树) README C++
0210 Course Schedule II 课程表 II README C++
0212 Word Search II 单词搜索 II README C++
0215 Kth Largest Element in an Array 数组中的第K个最大元素 README C++
0217 Contains Duplicate 存在重复元素 README C++
0218 The Skyline Problem 天际线问题 README C++
0221 Maximal Square 最大正方形 README C++
0227 Basic Calculator II 基本计算器 II README C++
0230 Kth Smallest Element in a BST 二叉搜索树中第K小的元素 README C++
0234 Palindrome Linked List 回文链表 README C++
0236 Lowest Common Ancestor of a Binary Tree 二叉树的最近公共祖先 README C++
0237 Delete Node in a Linked List 删除链表中的节点 README C++
0238 Product of Array Except Self 除自身以外数组的乘积 README C++
0239 Sliding Window Maximum 滑动窗口最大值 README C++
0240 Search a 2D Matrix II 搜索二维矩阵 II README C++
0242 Valid Anagram 有效的字母异位词 README C++
0268 Missing Number 缺失数字 README C++
0278 First Bad Version 第一个错误的版本 README C++
0279 Perfect Squares 完全平方数 README C++
0283 Move Zeroes 移动零 README C++
0287 Find the Duplicate Number 寻找重复数 README C++
0289 Game of Life 生命游戏 README C++
0295 Find Median from Data Stream 数据流的中位数 README C++
0297 Serialize and Deserialize Binary Tree 二叉树的序列化与反序列化 README C++
0300 Longest Increasing Subsequence 最长上升子序列 README C++
0301 Remove Invalid Parentheses 删除无效的括号 README C++
0309 Best Time to Buy and Sell Stock with Cooldown 最佳买卖股票时机含冷冻期 README C++
0312 Burst Balloons 戳气球 README C++
0315 Count of Smaller Numbers After Self 计算右侧小于当前元素的个数 README C++
0322 Coin Change 零钱兑换 README C++
0324 Wiggle Sort II 摆动排序 II README C++
0326 Power of Three 3的幂 README C++
0328 Odd Even Linked List 奇偶链表 README C++
0329 Longest Increasing Path in a Matrix 矩阵中的最长递增路径 README C++
0334 Increasing Triplet Subsequence 递增的三元子序列 README C++
0337 House Robber III 打家劫舍 III README C++
0341 Flatten Nested List Iterator 扁平化嵌套列表迭代器 README C++
0344 Reverse String 反转字符串 README C++
0347 Top K Frequent Elements 前 K 个高频元素 README C++
0350 Intersection of Two Arrays II 两个数组的交集 II README C++
0354 Russian Doll Envelopes 俄罗斯套娃信封问题 README C++
0371 Sum of Two Integers 两整数之和 README C++
0378 Kth Smallest Element in a Sorted Matrix 有序矩阵中第K小的元素 README C++
0380 Insert Delete GetRandom O(1) 常数时间插入、删除和获取随机元素 README C++
0384 Shuffle an Array 打乱数组 README C++
0387 First Unique Character in a String 字符串中的第一个唯一字符 README C++
0406 Queue Reconstruction by Height 根据身高重建队列 README C++
0412 Fizz Buzz Fizz Buzz README C++
0416 Partition Equal Subset Sum 分割等和子集 README C++
0429 N-ary Tree Level Order Traversal N叉树的层序遍历 README C++
0437 Path Sum III 路径总和 III README C++
0450 Delete Node in a BST 删除二叉搜索树中的节点 README C++
0454 4Sum II 四数相加 II README C++
0461 Hamming Distance 汉明距离 README C++
0538 Convert BST to Greater Tree 把二叉搜索树转换为累加树 README C++
0543 Diameter of Binary Tree 二叉树的直径 README C++
0547 Friend Circles 朋友圈 README C++
0559 Maximum Depth of N-ary Tree N叉树的最大深度 README C++
0560 Subarray Sum Equals K 和为K的子数组 README C++
0589 N-ary Tree Preorder Traversal N叉树的前序遍历 README C++
0590 N-ary Tree Postorder Traversal N叉树的后序遍历 README C++
0621 Task Scheduler 任务调度器 README C++
0912 Sort an Array 排序数组 README C++
1114 Print in Order 按序打印 README C++
1115 Print FooBar Alternately 交替打印FooBar README C++
1116 Print Zero Even Odd 打印零与奇偶数 README C++
1117 Building H2O H2O 生成 README C++
1195 Fizz Buzz Multithreaded 交替打印字符串 README C++
1226 The Dining Philosophers 哲学家进餐 README C++