LeetCode-Solutions-in-Cpp17

Solutions to high-frequency interview questions of LeetCode in C++17, taking into account both efficiency and comprehensibility.


Project maintained by downdemo Hosted on GitHub Pages — Theme by mattgraham

数组和字符串(Array and String)

# Title 中文站 Solution Code
0015 3Sum 三数之和 README C++
0073 Set Matrix Zeroes 矩阵置零 README C++
0049 Group Anagrams 字母异位词分组 README C++
0003 Longest Substring Without Repeating Characters 无重复字符的最长子串 README C++
0005 Longest Palindromic Substring 最长回文子串 README C++
0334 Increasing Triplet Subsequence 递增的三元子序列 README C++

链表(Linked List)

# Title 中文站 Solution Code
0002 Add Two Numbers 两数相加 README C++
0328 Odd Even Linked List 奇偶链表 README C++
0160 Intersection of Two Linked Lists 相交链表 README C++

树和图(Tree and Graph)

# Title 中文站 Solution Code
0094 Binary Tree Inorder Traversal 二叉树的中序遍历 README C++
0103 Binary Tree Zigzag Level Order Traversal 二叉树的锯齿形层次遍历 README C++
0105 Construct Binary Tree from Preorder and Inorder Traversal 从前序与中序遍历序列构造二叉树 README C++
0116 Populating Next Right Pointers in Each Node 填充每个节点的下一个右侧节点指针 README C++
0230 Kth Smallest Element in a BST 二叉搜索树中第K小的元素 README C++
0200 Number of Islands 岛屿数量 README C++

回溯算法(Backtracking)

# Title 中文站 Solution Code
0017 Letter Combinations of a Phone Number 电话号码的字母组合 README C++
0022 Generate Parentheses 括号生成 README C++
0046 Permutations 全排列 README C++
0078 Subsets 子集 README C++
0079 Word Search 单词搜索 README C++

排序和搜索(Sorting and Searching)

# Title 中文站 Solution Code
0075 Sort Colors 颜色分类 README C++
0347 Top K Frequent Elements 前 K 个高频元素 README C++
0215 Kth Largest Element in an Array 数组中的第K个最大元素 README C++
0162 Find Peak Element 寻找峰值 README C++
0034 Find First and Last Position of Element in Sorted Array 在排序数组中查找元素的第一个和最后一个位置 README C++
0056 Merge Intervals 合并区间 README C++
0033 Search in Rotated Sorted Array 搜索旋转排序数组 README C++
0240 Search a 2D Matrix II 搜索二维矩阵 II README C++

动态规划(Dynamic Programming)

# Title 中文站 Solution Code
0055 Jump Game 跳跃游戏 README C++
0062 Unique Paths 不同路径 README C++
0322 Coin Change 零钱兑换 README C++
0300 Longest Increasing Subsequence 最长上升子序列 README C++

设计问题(Design)

# Title 中文站 Solution Code
0297 Serialize and Deserialize Binary Tree 二叉树的序列化与反序列化 README C++
0380 Insert Delete GetRandom O(1) 常数时间插入、删除和获取随机元素 README C++

数学(Math)

# Title 中文站 Solution Code
0202 Happy Number 快乐数 README C++
0172 Factorial Trailing Zeroes 阶乘后的零 README C++
0171 Excel Sheet Column Number Excel表列序号 README C++
0050 Pow(x, n) Pow(x, n) README C++
0069 Sqrt(x) x 的平方根 README C++
0029 Divide Two Integers 两数相除 README C++
0166 Fraction to Recurring Decimal 分数到小数 README C++

其他(Other)

# Title 中文站 Solution Code
0371 Sum of Two Integers 两整数之和 README C++
0150 Evaluate Reverse Polish Notation 逆波兰表达式求值 README C++
0169 Majority Element 多数元素 README C++
0621 Task Scheduler 任务调度器 README C++