Leetcode 问题总结
Index of c++ code in github or this blog, easy for search and read.
# Important
- Variadic function (可变长参数函数): average the number (opens new window)
# DP
Maximum Subarray (opens new window): 子序列和的最大值,初步的动态规划
Unique Path (opens new window): 机器人走矩形,简单的动态规划
Climbing Stairs (opens new window): 一次爬 1 或者 2 步,所有的可能爬上去的方式
House Robber (opens new window): 动态规划问题,3 个版本
# BFS
- Jump array (opens new window): 最少的步数调到数组结尾
# String
decimalism (opens new window) : 十六进制和十进制的转化
Longest Palindromic Substring (opens new window): 最长回文子序列,如何求字符串的所有 substring? 如何动态规划求最长回文子串?
Palindromic Substrings (opens new window): 求一个字符串的所有回文子串
# Map & Set
- word count (opens new window): 统计一行中相同单词的出现次数,map 的经典应用
# Tree
Symmetric Tree (opens new window): 判断二叉树是否对称
Invert Binary Tree (opens new window): 镜像(对称)翻转二叉树
Path Sum III (opens new window): 找出树中的路径,使其和为某个固定的数
Construct Binary Tree from Preorder and Inorder Traversal (opens new window): 根据先序和中序遍历结果确定二叉树
# Linked List
Intersection of Two Linked Lists (opens new window): 求链表的重复交叉
Merge Two Sorted Lists (opens new window): 按序合并两个链表,使用递归
Linked List Cycle II (opens new window): 求链表环的交点位置
# Recursion
Merge Two Sorted Lists (opens new window): 按序合并两个链表,使用递归
Reverse Linked List (opens new window): reverse a list
Path Sum III (opens new window): 找出树中的路径,使其和为某个固定的数
# C basic
pointer-1 (opens new window): 从函数返回多个数据项
pointer-2 (opens new window):数组和指针之间的转化
pointer-3 (opens new window):对数据的拷贝,别名和复制
# Math
Reverse Integer (opens new window): reverse digits of an integer. Reference in C++ Integer Limits (opens new window)
Majority Element (opens new window): 找数组中的出现次数多余 n // 2 的数
Move Zeroes (opens new window): 将数组中的 0 元素全部移位到数组后端
Find All Numbers Disappeared in an Array (opens new window): 找出数组中的未出现的元素
# Stack
# STL
- count_if (opens new window) narcissistic number (水仙花数), find the common between two vectors