/LeetCode

:pencil2: LeetCode solutions in C++ 11

Primary LanguageC++MIT LicenseMIT

LeetCode

LeetCode solutions in C++ 11. (From Easy to Hard)

NO. Title Solution Add Date Difficulty
1 Single Number [C++](001. Single Number/solution.h) 2014/10/15 Medium
2 Maximum Depth of Binary Tree [C++](002. Maximum Depth of Binary Tree/solution.h) 2014/10/16 Easy
3 Same Tree [C++](003. Same Tree/solution.h) 2014/10/17 Easy
4 Reverse Integer [C++](004. Reverse Integer/solution.h) 2014/10/18 Easy
5 Best Time to Buy and Sell Stock II [C++](005. Best Time to Buy and Sell Stock II/solution.h) 2014/10/19 Medium
6 Unique Binary Search Trees [C++](006. Unique Binary Search Trees/solution.h) 2014/10/20 Medium
7 Linked List Cycle [C++](007. Linked List Cycle/solution.h) 2014/10/21 Medium
8 Binary Tree Inorder Traversal [C++](008. Binary Tree Inorder Traversal/solution.h) 2014/10/22 Medium
9 Binary Tree Preorder Traversal [C++](009. Binary Tree Preorder Traversal/solution.h) 2014/10/23 Medium
10 Populating Next Right Pointers in Each Node [C++](010. Populating Next Right Pointers in Each Node/solution.h) 2014/10/24 Medium
11 Search Insert Position [C++](011. Search Insert Position/solution.h) 2014/10/25 Medium
12 Remove Duplicates from Sorted List [C++](012. Remove Duplicates from Sorted List/solution.h) 2014/10/26 Easy
13 Climbing Stairs [C++](013. Climbing Stairs/solution.h) 2014/10/27 Easy
14 Maximum Subarray [C++](014. Maximum Subarray/solution.h) 2014/10/28 Medium
15 N-Queens II [C++](015. N-Queens II/solution.h) 2014/10/29 Hard
16 Roman to Integer [C++](016. Roman to Integer/solution.h) 2014/10/30 Easy
17 Integer to Roman [C++](017. Integer to Roman/solution.h) 2014/10/31 Medium
18 Single Number II [C++](018. Single Number II/solution.h) 2014/11/01 Medium
19 Merge Two Sorted Lists [C++](019. Merge Two Sorted Lists/solution.h) 2014/11/02 Easy
20 Remove Element [C++](020. Remove Element/solution.h) 2014/11/03 Easy
21 Convert Sorted Array to Binary Search Tree [C++](021. Convert Sorted Array to Binary Search Tree/solution.h) 2014/11/04 Medium
22 Balanced Binary Tree [C++](022. Balanced Binary Tree/solution.h) 2014/11/05 Easy
23 Swap Nodes in Pairs [C++](023. Swap Nodes in Pairs/solution.h) 2014/11/06 Medium
24 Remove Duplicates from Sorted Array [C++](024. Remove Duplicates from Sorted Array/solution.h) 2014/11/07 Easy
25 Sort Colors [C++](025. Sort Colors/solution.h) 2014/11/08 Medium
26 Merge Sorted Array [C++](026. Merge Sorted Array/solution.h) 2014/11/09 Easy
27 Symmetric Tree [C++](027. Symmetric Tree/solution.h) 2014/11/10 Easy
28 Gray Code [C++](028. Gray Code/solution.h) 2014/11/11 Medium
29 Unique Paths [C++](029. Unique Paths/solution.h) 2014/11/12 Medium
30 Plus One [C++](030. Plus One/solution.h) 2014/11/13 Easy
31 Generate Parentheses [C++](031. Generate Parentheses/solution.h) 2014/11/14 Medium
32 Pascal's Triangle [C++](032. Pascal's Triangle/solution.h) 2014/11/15 Easy
33 Container With Most Water [C++](033. Container With Most Water/solution.h) 2014/11/16 Medium
34 Permutations [C++](034. Permutations/solution.h) 2014/11/17 Medium
35 Rotate Image [C++](035. Rotate Image/solution.h) 2014/11/18 Medium
36 Search a 2D Matrix [C++](036. Search a 2D Matrix/solution.h) 2014/11/19 Medium
37 Find Minimum in Rotated Sorted Array [C++](037. Find Minimum in Rotated Sorted Array/solution.h) 2014/11/20 Medium
38 Minimum Path Sum [C++](038. Minimum Path Sum/solution.h) 2014/11/21 Medium
39 Best Time to Buy and Sell Stock [C++](039. Best Time to Buy and Sell Stock/solution.h) 2014/11/22 Medium
40 Binary Tree Level Order Traversal II [C++](040. Binary Tree Level Order Traversal II/solution.h) 2014/11/23 Easy
41 Search in Rotated Sorted Array II [C++](041. Search in Rotated Sorted Array II/solution.h) 2014/11/24 Medium
42 Binary Tree Postorder Traversal [C++](042. Binary Tree Postorder Traversal/solution.h) 2014/11/25 Hard
43 Linked List Cycle II [C++](043. Linked List Cycle II/solution.h) 2014/11/26 Medium
44 Set Matrix Zeroes [C++](044. Set Matrix Zeroes/solution.h) 2014/11/27 Medium
45 Spiral Matrix II [C++](045. Spiral Matrix II/solution.h) 2014/11/28 Medium
46 Remove Duplicates from Sorted Array II [C++](046. Remove Duplicates from Sorted Array II/solution.h) 2014/11/29 Medium
47 Populating Next Right Pointers in Each Node II [C++](047. Populating Next Right Pointers in Each Node II/solution.h) 2014/11/30 Hard
48 Binary Tree Level Order Traversal [C++](048. Binary Tree Level Order Traversal/solution.h) 2014/12/01 Easy
49 Path Sum [C++](049. Path Sum/solution.h) 2014/12/02 Easy
50 Pascal's Triangle II [C++](050. Pascal's Triangle II/solution.h) 2014/12/03 Easy
51 Combinations [C++](051. Combinations/solution.h) 2014/12/04 Medium
52 Sum Root to Leaf Numbers [C++](052. Sum Root to Leaf Numbers/solution.h) 2014/12/05 Medium
53 Remove Nth Node from End of List [C++](053. Remove Nth Node from End of List/solution.h) 2014/12/06 Easy
54 Minimum Depth of Binary Tree [C++](054. Minimum Depth of Binary Tree/solution.h) 2014/12/07 Easy
55 Length of Last Word [C++](055. Length of Last Word/solution.h) 2014/12/08 Easy
56 Trapping Rain Water [C++](056. Trapping Rain Water/solution.h) 2014/12/09 Hard
57 Palindrome Number [C++](057. Palindrome Number/solution.h) 2014/12/10 Easy
58 Search in Rotated Sorted Array [C++](058. Search in Rotated Sorted Array/solution.h) 2014/12/11 Hard
59 Valid Parentheses [C++](059. Valid Parentheses/solution.h) 2014/12/12 Easy
60 Flatten Binary Tree to Linked List [C++](060. Flatten Binary Tree to Linked List/solution.h) 2014/12/13 Medium
61 Longest Consecutive Sequence [C++](061. Longest Consecutive Sequence/solution.h) 2014/12/14 Hard
62 Unique Paths II [C++](062. Unique Paths II/solution.h) 2014/12/15 Medium
63 Subsets [C++](063. Subsets/solution.h) 2014/12/16 Medium
64 Valid Sudoku [C++](064. Valid Sudoku/solution.h) 2014/12/17 Easy
65 Unique Binary Search Trees II [C++](065. Unique Binary Search Trees II/solution.h) 2014/12/18 Medium
66 Convert Sorted List to Binary Search Tree [C++](066. Convert Sorted List to Binary Search Tree/solution.h) 2014/12/19 Medium
67 Search for a Range [C++](067. Search for a Range/solution.h) 2014/12/20 Medium
68 Jump Game [C++](068. Jump Game/solution.h) 2014/12/21 Medium
69 Count and Say [C++](069. Count and Say/solution.h) 2014/12/22 Easy
70 Longest Common Prefix [C++](070. Longest Common Prefix/solution.h) 2014/12/23 Easy
71 Subsets II [C++](071. Subsets II/solution.h) 2014/12/24 Medium
72 Partition List [C++](072. Partition List/solution.h) 2014/12/25 Medium
73 3Sum Closest [C++](073. 3Sum Closest/solution.h) 2014/12/26 Medium
74 Path Sum II [C++](074. Path Sum II/solution.h) 2014/12/27 Medium
75 Combination Sum [C++](075. Combination Sum/solution.h) 2014/12/28 Medium
76 Triangle [C++](076. Triangle/solution.h) 2014/12/29 Medium
77 Construct Binary Tree from Inorder and Postorder Traversal [C++](077. Construct Binary Tree from Inorder and Postorder Traversal/solution.h) 2014/12/30 Medium
78 Binary Tree Zigzag Level Order Traversal [C++](078. Binary Tree Zigzag Level Order Traversal/solution.h) 2014/12/31 Medium
79 Construct Binary Tree from Preorder and Inorder Traversal [C++](079. Construct Binary Tree from Preorder and Inorder Traversal/solution.h) 2015/01/01 Medium
80 Letter Combinations of a Phone Number [C++](080. Letter Combinations of a Phone Number/solution.h) 2015/01/02 Medium
81 Reverse Linked List II [C++](081. Reverse Linked List II/solution.h) 2015/01/03 Medium
82 Pow(x, n) [C++](082. Pow(x, n)/solution.h) 2015/01/04 Medium
83 N-Queens [C++](083. N-Queens/solution.h) 2015/01/05 Hard
84 Gas Station [C++](084. Gas Station/solution.h) 2015/01/06 Medium
85 Palindrome Partitioning [C++](085. Palindrome Partitioning/solution.h) 2015/01/07 Medium
86 Validate Binary Search Tree [C++](086. Validate Binary Search Tree/solution.h) 2015/01/08 Medium
87 Add Binary [C++](087. Add Binary/solution.h) 2015/01/09 Easy
88 Edit Distance [C++](088. Edit Distance/solution.h) 2015/01/10 Hard
89 Next Permutation [C++](089. Next Permutation/solution.h) 2015/01/11 Medium
90 Insertion Sort List [C++](090. Insertion Sort List/solution.h) 2015/01/12 Medium
91 Reverse Nodes in k-Group [C++](091. Reverse Nodes in k-Group/solution.h) 2015/01/13 Hard
92 Distinct Subsequences [C++](092. Distinct Subsequences/solution.h) 2015/01/14 Hard
93 Permutations II [C++](093. Permutations II/solution.h) 2015/01/15 Hard
94 Remove Duplicates from Sorted List II [C++](094. Remove Duplicates from Sorted List II/solution.h) 2015/01/16 Medium
95 Jump Game II [C++](095. Jump Game II/solution.h) 2015/01/17 Hard
96 Combination Sum II [C++](096. Combination Sum II/solution.h) 2015/01/18 Medium
97 Anagrams [C++](097. Anagrams/solution.h) 2015/01/19 Medium
98 Recover Binary Search Tree [C++](098. Recover Binary Search Tree/solution.h) 2015/01/20 Hard
99 ZigZag Conversion [C++](099. ZigZag Conversion/solution.h) 2015/01/21 Easy
100 Copy List with Random Pointer [C++](100. Copy List with Random Pointer/solution.h) 2015/01/22 Hard
101 Clone Graph [C++](101. Clone Graph/solution.h) 2015/01/23 Medium
102 Add Two Numbers [C++](102. Add Two Numbers/solution.h) 2015/01/24 Medium
103 Scramble String [C++](103. Scramble String/solution.h) 2015/01/25 Hard
104 Valid Palindrome [C++](104. Valid Palindrome/solution.h) 2015/01/26 Easy
105 First Missing Positive [C++](105. First Missing Positive/solution.h) 2015/01/27 Hard
106 Best Time to Buy and Sell Stock III [C++](106. Best Time to Buy and Sell Stock III/solution.h) 2015/01/28 Hard
107 Sqrt(x) [C++](107. Sqrt(x)/solution.h) 2015/01/29 Medium
108 Permutation Sequence [C++](108. Permutation Sequence/solution.h) 2015/01/30 Medium
109 Longest Substring Without Repeating Characters [C++](109. Longest Substring Without Repeating Characters/solution.h) 2015/01/31 Medium
110 Rotate List [C++](110. Rotate List/solution.h) 2015/02/01 Medium
111 Implement strStr() [C++](111. Implement strStr()/solution.h) 2015/02/02 Easy
112 4Sum [C++](112. 4Sum/solution.h) 2015/02/03 Medium
113 Maximal Rectangle [C++](113. Maximal Rectangle/solution.h) 2015/02/04 Hard
114 Largest Rectangle in Histogram [C++](114. Largest Rectangle in Histogram/solution.h) 2015/02/05 Hard
115 Merge k Sorted Lists [C++](115. Merge k Sorted Lists/solution.h) 2015/02/06 Hard
116 Word Break [C++](116. Word Break/solution.h) 2015/02/07 Medium
117 Merge Intervals [C++](117. Merge Intervals/solution.h) 2015/02/08 Hard
118 Sudoku Solver [C++](118. Sudoku Solver/solution.h) 2015/02/09 Hard
119 Longest Palindromic Substring [C++](119. Longest Palindromic Substring/solution.h) 2015/02/10 Medium
120 Insert Interval [C++](120. Insert Interval/solution.h) 2015/02/11 Hard
121 Spiral Matrix [C++](121. Spiral Matrix/solution.h) 2015/02/12 Medium
122 Sort List [C++](122. Sort List/solution.h) 2015/02/13 Medium
123 Restore IP Addresses [C++](123. Restore IP Addresses/solution.h) 2015/02/14 Medium
124 Multiply Strings [C++](124. Multiply Strings/solution.h) 2015/02/15 Medium
125 Reorder List [C++](125. Reorder List/solution.h) 2015/02/16 Medium
126 Binary Tree Maximum Path Sum [C++](126. Binary Tree Maximum Path Sum/solution.h) 2015/02/17 Hard
127 Regular Expression Matching [C++](127. Regular Expression Matching/solution.h) 2015/02/18 Hard
128 Simplify Path [C++](128. Simplify Path/solution.h) 2015/02/19 Medium
129 Word Search [C++](129. Word Search/solution.h) 2015/02/20 Medium
130 Evaluate Reverse Polish Notation [C++](130. Evaluate Reverse Polish Notation/solution.h) 2015/02/21 Medium
131 Longest Valid Parentheses [C++](131. Longest Valid Parentheses/solution.h) 2015/02/22 Hard
132 Interleaving String [C++](132. Interleaving String/solution.h) 2015/02/23 Hard
133 Candy [C++](133. Candy/solution.h) 2015/02/24 Hard
134 Find Minimum in Rotated Sorted Array II [C++](134. Find Minimum in Rotated Sorted Array II/solution.h) 2015/02/25 Hard
135 Word Ladder [C++](135. Word Ladder/solution.h) 2015/02/26 Medium
136 Two Sum [C++](136. Two Sum/solution.h) 2015/02/27 Medium
137 Palindrome Partitioning II [C++](137. Palindrome Partitioning II/solution.h) 2015/02/28 Hard
138 Minimum Window Substring [C++](138. Minimum Window Substring/solution.h) 2015/03/01 Hard
139 Substring with Concatenation of All Words [C++](139. Substring with Concatenation of All Words/solution.h) 2015/03/02 Hard
140 Median of Two Sorted Arrays [C++](140. Median of Two Sorted Arrays/solution.h) 2015/03/03 Hard
141 3Sum [C++](141. 3Sum/solution.h) 2015/03/04 Medium
142 Divide Two Integers [C++](142. Divide Two Integers/solution.h) 2015/03/05 Medium
143 Word Break II [C++](143. Word Break II/solution.h) 2015/03/06 Hard
144 Decode Ways [C++](144. Decode Ways/solution.h) 2015/03/07 Medium
145 Maximum Product Subarray [C++](145. Maximum Product Subarray/solution.h) 2015/03/08 Medium
146 String to Integer (atoi) [C++](146. String to Integer (atoi)/solution.h) 2015/03/09 Easy
147 Wildcard Matching [C++](147. Wildcard Matching/solution.h) 2015/03/10 Hard
148 Surrounded Regions [C++](148. Surrounded Regions/solution.h) 2015/03/11 Medium
149 Reverse Words in a String [C++](149. Reverse Words in a String/solution.h) 2015/03/12 Medium
150 LRU Cache [C++](150. LRU Cache/solution.h) 2015/03/13 Hard
151 Text Justification [C++](151. Text Justification/solution.h) 2015/03/14 Hard
152 Word Ladder II [C++](152. Word Ladder II/solution.h) 2015/03/15 Hard
153 Valid Number [C++](153. Valid Number/solution.h) 2015/03/16 Easy
154 Max Points on a Line [C++](154. Max Points on a Line/solution.h) 2015/03/17 Hard