LeetCode 解题代码 部分题目有题解,见 LeetCode Content Problem ID Solution Topic 1 Two Sum 2 Add Two Numbers 3 Longest Substring Without Repeating Characters 6 ZigZag Conversion 7 Reverse Integer 9 Palindrome Number 11 Container With Most Water 13 Roman to Integer 14 Longest Common Prefix 15 3Sum 17 Letter Combinations of a Phone Number 19 Remove Nth Node From End of List 20 Valid Parentheses 21 Merge Two Sorted Lists 26 Remove Duplicates from Sorted Array 数组, 双指针 27 Remove Element 数组, 双指针 28 Implement strStr() 29 Divide Two Integers 31 Next Permutation 33 Search in Rotated Sorted Array 35 Search Insert Position 36 Valid Sudoku 43 Multiply Strings 45 Jump Game II 46 Permutations 47 Permutations II 49 Group Anagrams 50 Pow(x, n) 53 Maximum Subarray 56 Merge Intervals 66 Plus One 67 Add Binary 69 Sqrt(x) 70 Climbing Stairs 73 Set Matrix Zeroes 75 Sort Colors 77 Combinations 78 Subsets 79 Word Search 83 Remove Duplicates from Sorted List 88 Merge Sorted Array 94 Binary Tree Inorder Traversal 98 Validate Binary Search Tree 100 Same Tree 101 Symmetric Tree 102 Binary Tree Level Order Traversal 104 Maximum Depth of Binary Tree 105 Construct Binary Tree from Preorder and Inorder Traversal 107 Binary Tree Level Order Traversal II 108 Convert Sorted Array to Binary Search Tree 109 Convert Sorted List to Binary Search Tree 110 Balanced Binary Tree 111 Minimum Depth of Binary Tree 112 Path Sum 114 Flatten Binary Tree to Linked List 116 Populating Next Right Pointers in Each Node 118 Pascal's Triangle 119 Pascal's Triangle II 121 Best Time to Buy and Sell Stock 129 Sum Root to Leaf Numbers 树, 深度优先搜索, 二叉树 133 Clone Graph 136 Single Number 141 Linked List Cycle 142 Linked List Cycle II 144 Binary Tree Preorder Traversal 145 Binary Tree Postorder Traversal 152 Maximum Product Subarray 155 Min Stack 160 Intersection of Two Linked Lists 162 Find Peak Element 167 Two Sum II - Input array is sorted 169 Majority Element 191 Number of 1 Bits 200 Number of Islands 203 Remove Linked List Elements 206 Reverse Linked List 207 Course Schedule 215 Kth Largest Element in an Array 217 Contains Duplicate 226 Invert Binary Tree 232 Implement Queue using Stacks 234 Palindrome Linked List 栈, 递归, 链表, 双指针 235 Lowest Common Ancestor of a Binary Search Tree 236 Lowest Common Ancestor of a Binary Tree 树, 深度优先搜索, 二叉树 237 Delete Node in a Linked List 257 Binary Tree Paths 242 Valid Anagram 283 Move Zeroes 数组, 双指针 328 Odd Even Linked List 338 Counting Bits 位运算, 动态规划 341 Flatten Nested List Iterator 344 Reverse String 347 Top K Frequent Elements 349 Intersection of Two Arrays 350 Intersection of Two Arrays II 367 Valid Perfect Square 383 Ransom Note 387 First Unique Character in a String 415 Add Strings 438 Find All Anagrams in a String 448 Find All Numbers Disappeared in an Array 数组, 哈希表 456 132 Pattern 位运算 461 Hamming Distance 515 Find Largest Value in Each Tree Row 520 Detect Capital 521 Longest Uncommon Subsequence I 532 K-diff Pairs in an Array 543 Diameter of Binary Tree 树, 深度优先搜索, 二叉树 547 Number of Provinces 并查集 557 Reverse Words in a String III 566 Reshape the Matrix 617 Merge Two Binary Trees 633 Sum of Square Numbers 双指针 643 Maximum Average Subarray I 数组, 滑动窗口 653 Two Sum IV - Input is a BST 657 Judge Route Circle 669 Trim a Binary Search Tree 674 Longest Continuous Increasing Subsequence 数组 684 Redundant Connection Union Find 690 Employee Importance 695 Max Area of Island DFS 696 Count Binary Substrings 700 Search in a Binary Search Tree 701 Insert into a Binary Search Tree 703 Kth Largest Element in a Stream 739 Daily Temperatures 746 Min Cost Climbing Stairs 784 Letter Case Permutation 819 Most Common Word 852 Peak Index in a Mountain Array 922 Sort Array By Parity II 973 K Closest Points to Origin 1191 K-Concatenation Maximum Sum Dynamic Programming 1143 Longest Common Subsequence 1219 Path with Maximum Gold Backtracking 1423 Maximum Points You Can Obtain from Cards 数组, 滑动窗口, 前缀和 1472 Design Browser History 参考资料 一些有用的参考资料 C++ STL powerful guide | Compiled list of popular STL operations 滑动窗口(思路 + 模板)