Skip to content

ruyiwei-cas/LEETCODE_ANWSER

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LeetCode

LeetCode solutions gives some thoughts on selected problems.

Solved 353/353 problems.

Database

See database.md

Algorithms

# Title Solution
370 Range Addition range-addition.cc
369 Plus One Linked List plus-one-linked-list.cc
368 Largest Divisible Subset largest-divisible-subset.cc
367 Valid Perfect Square valid-perfect-square.cc
366 Find Leaves of Binary Tree find-leaves-of-binary-tree.cc
365 Water and Jug Problem water-and-jug-problem.cc
364 Nested List Weight Sum II nested-list-weight-sum-ii.cc
363 Max Sum of Rectangle No Larger Than K max-sum-of-sub-matrix-no-larger-than-k.cc
362 Design Hit Counter design-hit-counter.cc
361 Bomb Enemy bomb-enemy.cc
360 Sort Transformed Array sort-transformed-array.cc
359 Logger Rate Limiter logger-rate-limiter.cc
358 Rearrange String k Distance Apart rearrange-string-k-distance-apart.cc
357 Count Numbers with Unique Digits count-numbers-with-unique-digits.cc
356 Line Reflection line-reflection.cc
355 Design Twitter design-twitter.cc
354 Russian Doll Envelopes russian-doll-envelopes.cc
353 Design Snake Game design-snake-game.cc
352 Data Stream as Disjoint Intervals data-stream-as-disjoint-intervals.cc
351 Android Unlock Patterns android-unlock-patterns.cc
350 Intersection of Two Arrays II intersection-of-two-arrays-ii.cc
349 Intersection of Two Arrays intersection-of-two-arrays.cc
348 Design Tic-Tac-Toe design-tic-tac-toe.cc
347 Top K Frequent Elements top-k-frequent-elements.cc
346 Moving Average from Data Stream moving-average-from-data-stream.cc
345 Reverse Vowels of a String reverse-vowels-of-a-string.cc
344 Reverse String reverse-string.cc
343 Integer Break integer-break.cc
342 Power of Four power-of-four.cc
341 Flatten Nested List Iterator flatten-nested-list-iterator.cc
340 Longest Substring with At Most K Distinct Characters longest-substring-with-at-most-k-distinct-characters.cc
339 Nested List Weight Sum nested-list-weight-sum.cc
338 Counting Bits counting-bits.cc
337 House Robber III house-robber-iii.cc
336 Palindrome Pairs palindrome-pairs.cc
335 Self Crossing self-crossing.cc
334 Increasing Triplet Subsequence increasing-triplet-subsequence.cc
333 Largest BST Subtree largest-bst-subtree.cc
332 Reconstruct Itinerary reconstruct-itinerary.cc
331 Verify Preorder Serialization of a Binary Tree verify-preorder-serialization-of-a-binary-tree.cc
330 Patching Array patching-array.cc
329 Longest Increasing Path in a Matrix longest-increasing-path-in-a-matrix.cc
328 Odd Even Linked List odd-even-linked-list.cc
327 Count of Range Sum count-of-range-sum.cc
326 Power of Three power-of-three.cc
325 Maximum Size Subarray Sum Equals k maximum-size-subarray-sum-equals-k.cc
324 Wiggle Sort II wiggle-sort-ii.cc
323 Number of Connected Components in an Undirected Graph number-of-connected-components-in-an-undirected-graph.cc
322 Coin Change coin-change.cc
321 Create Maximum Number create-maximum-number.cc
320 Generalized Abbreviation generalized-abbreviation.cc
319 Bulb Switcher bulb-switcher.cc
318 Maximum Product of Word Lengths maximum-product-of-word-lengths.cc
317 Shortest Distance from All Buildings shortest-distance-from-all-buildings.cc
316 Remove Duplicate Letters remove-duplicate-letters.cc
315 Count of Smaller Numbers After Self count-of-smaller-numbers-after-self.cc
314 Binary Tree Vertical Order Traversal binary-tree-vertical-order-traversal.cc
313 Super Ugly Number super-ugly-number.cc
312 Burst Balloons burst-balloons.cc
311 Sparse Matrix Multiplication sparse-matrix-multiplication.cc
310 Minimum Height Trees minimum-height-trees.cc
309 Best Time to Buy and Sell Stock with Cooldown best-time-to-buy-and-sell-stock-with-cooldown.cc
308 Range Sum Query 2D - Mutable range-sum-query-2d-mutable.cc
307 Range Sum Query - Mutable range-sum-query-mutable.cc
306 Additive Number additive-number.cc
305 Number of Islands II number-of-islands-ii.cc
304 Range Sum Query 2D - Immutable range-sum-query-2d-immutable.cc
303 Range Sum Query - Immutable range-sum-query-immutable.cc
302 Smallest Rectangle Enclosing Black Pixels smallest-rectangle-enclosing-black-pixels.cc
301 Remove Invalid Parentheses remove-invalid-parentheses.cc
300 Longest Increasing Subsequence longest-increasing-subsequence.cc
299 Bulls and Cows bulls-and-cows.cc
298 Binary Tree Longest Consecutive Sequence binary-tree-longest-consecutive-sequence.cc
297 Serialize and Deserialize Binary Tree serialize-and-deserialize-binary-tree.cc
296 Best Meeting Point best-meeting-point.cc
295 Find Median from Data Stream find-median-from-data-stream.cc
294 Flip Game II flip-game-ii.cc
293 Flip Game flip-game.cc
292 Nim Game nim-game.cc
291 Word Pattern II word-pattern-ii.cc
290 Word Pattern word-pattern.cc
289 Game of Life game-of-life.cc
288 Unique Word Abbreviation unique-word-abbreviation.cc
287 Find the Duplicate Number find-the-duplicate-number.cc
286 Walls and Gates walls-and-gates.cc
285 Inorder Successor in BST inorder-successor-in-bst.cc
284 Peeking Iterator peeking-iterator.cc
283 Move Zeroes move-zeroes.cc
282 Expression Add Operators expression-add-operators.cc
281 Zigzag Iterator zigzag-iterator.cc
280 Wiggle Sort wiggle-sort.cc
279 Perfect Squares perfect-squares.cc
278 First Bad Version first-bad-version.cc
277 Find the Celebrity find-the-celebrity.cc
276 Paint Fence paint-fence.cc
275 H-Index II h-index-ii.cc
274 H-Index h-index.cc
273 Integer to English Words integer-to-english-words.cc
272 Closest Binary Search Tree Value II closest-binary-search-tree-value-ii.cc
271 Encode and Decode Strings encode-and-decode-strings.cc
270 Closest Binary Search Tree Value closest-binary-search-tree-value.cc
269 Alien Dictionary alien-dictionary.cc
268 Missing Number missing-number.cc
267 Palindrome Permutation II palindrome-permutation-ii.cc
266 Palindrome Permutation palindrome-permutation.cc
265 Paint House II paint-house-ii.cc
264 Ugly Number II ugly-number-ii.cc
263 Ugly Number ugly-number.cc
261 Graph Valid Tree graph-valid-tree.cc
260 Single Number III single-number-iii.cc
259 3Sum Smaller 3sum-smaller.cc
258 Add Digits add-digits.cc
257 Binary Tree Paths binary-tree-paths.cc
256 Paint House paint-house.cc
255 Verify Preorder Sequence in Binary Search Tree verify-preorder-sequence-in-binary-search-tree.cc
254 Factor Combinations factor-combinations.cc
253 Meeting Rooms II meeting-rooms-ii.cc
252 Meeting Rooms meeting-rooms.cc
251 Flatten 2D Vector flatten-2d-vector.cc
250 Count Univalue Subtrees count-univalue-subtrees.cc
249 Group Shifted Strings group-shifted-strings.cc
248 Strobogrammatic Number III strobogrammatic-number-iii.cc
247 Strobogrammatic Number II strobogrammatic-number-ii.cc
246 Strobogrammatic Number strobogrammatic-number.cc
245 Shortest Word Distance III shortest-word-distance-iii.cc
244 Shortest Word Distance II shortest-word-distance-ii.cc
243 Shortest Word Distance shortest-word-distance.cc
242 Valid Anagram valid-anagram.cc
241 Different Ways to Add Parentheses different-ways-to-add-parentheses.cc
240 Search a 2D Matrix II search-a-2d-matrix-ii.cc
239 Sliding Window Maximum sliding-window-maximum.cc
238 Product of Array Except Self product-of-array-except-self.cc
237 Delete Node in a Linked List delete-node-in-a-linked-list.cc
236 Lowest Common Ancestor of a Binary Tree lowest-common-ancestor-of-a-binary-tree.cc
235 Lowest Common Ancestor of a Binary Search Tree lowest-common-ancestor-of-a-binary-search-tree.cc
234 Palindrome Linked List palindrome-linked-list.cc
233 Number of Digit One number-of-digit-one.cc
232 Implement Queue using Stacks implement-queue-using-stacks.cc
231 Power of Two power-of-two.cc
230 Kth Smallest Element in a BST kth-smallest-element-in-a-bst.cc
229 Majority Element II majority-element-ii.cc
228 Summary Ranges summary-ranges.cc
227 Basic Calculator II basic-calculator-ii.cc
226 Invert Binary Tree invert-binary-tree.cc
225 Implement Stack using Queues implement-stack-using-queues.cc
224 Basic Calculator basic-calculator.cc
223 Rectangle Area rectangle-area.cc
222 Count Complete Tree Nodes count-complete-tree-nodes.cc
221 Maximal Square maximal-square.cc
220 Contains Duplicate III contains-duplicate-iii.cc
219 Contains Duplicate II contains-duplicate-ii.cc
218 The Skyline Problem the-skyline-problem.cc
217 Contains Duplicate contains-duplicate.cc
216 Combination Sum III combination-sum-iii.cc
215 Kth Largest Element in an Array kth-largest-element-in-an-array.cc
214 Shortest Palindrome shortest-palindrome.cc
213 House Robber II house-robber-ii.cc
212 Word Search II word-search-ii.cc
211 Add and Search Word - Data structure design add-and-search-word-data-structure-design.cc
210 Course Schedule II course-schedule-ii.cc
209 Minimum Size Subarray Sum minimum-size-subarray-sum.cc
208 Implement Trie (Prefix Tree) implement-trie-prefix-tree.cc
207 Course Schedule course-schedule.cc
206 Reverse Linked List reverse-linked-list.cc
205 Isomorphic Strings isomorphic-strings.cc
204 Count Primes count-primes.cc
203 Remove Linked List Elements remove-linked-list-elements.cc
202 Happy Number happy-number.cc
201 Bitwise AND of Numbers Range bitwise-and-of-numbers-range.cc
200 Number of Islands number-of-islands.cc
199 Binary Tree Right Side View binary-tree-right-side-view.cc
198 House Robber house-robber.cc
191 Number of 1 Bits number-of-1-bits.cc
190 Reverse Bits reverse-bits.cc
189 Rotate Array rotate-array.cc
188 Best Time to Buy and Sell Stock IV best-time-to-buy-and-sell-stock-iv.cc
187 Repeated DNA Sequences repeated-dna-sequences.cc
186 Reverse Words in a String II reverse-words-in-a-string-ii.cc
179 Largest Number largest-number.cc
174 Dungeon Game dungeon-game.cc
173 Binary Search Tree Iterator binary-search-tree-iterator.cc
172 Factorial Trailing Zeroes factorial-trailing-zeroes.cc
171 Excel Sheet Column Number excel-sheet-column-number.cc
170 Two Sum III - Data structure design two-sum-iii-data-structure-design.cc
169 Majority Element majority-element.cc
168 Excel Sheet Column Title excel-sheet-column-title.cc
167 Two Sum II - Input array is sorted two-sum-ii-input-array-is-sorted.cc
166 Fraction to Recurring Decimal fraction-to-recurring-decimal.cc
165 Compare Version Numbers compare-version-numbers.cc
164 Maximum Gap maximum-gap.cc
163 Missing Ranges missing-ranges.cc
162 Find Peak Element find-peak-element.cc
161 One Edit Distance one-edit-distance.cc
160 Intersection of Two Linked Lists intersection-of-two-linked-lists.cc
159 Longest Substring with At Most Two Distinct Characters longest-substring-with-at-most-two-distinct-characters.cc
158 Read N Characters Given Read4 II - Call multiple times read-n-characters-given-read4-ii-call-multiple-times.cc
157 Read N Characters Given Read4 read-n-characters-given-read4.cc
156 Binary Tree Upside Down binary-tree-upside-down.cc
155 Min Stack min-stack.cc
154 Find Minimum in Rotated Sorted Array II find-minimum-in-rotated-sorted-array-ii.cc
153 Find Minimum in Rotated Sorted Array find-minimum-in-rotated-sorted-array.cc
152 Maximum Product Subarray maximum-product-subarray.cc
151 Reverse Words in a String reverse-words-in-a-string.cc
150 Evaluate Reverse Polish Notation evaluate-reverse-polish-notation.cc
149 Max Points on a Line max-points-on-a-line.cc
148 Sort List sort-list.cc
147 Insertion Sort List insertion-sort-list.cc
146 LRU Cache lru-cache.cc
145 Binary Tree Postorder Traversal binary-tree-postorder-traversal.cc
144 Binary Tree Preorder Traversal binary-tree-preorder-traversal.cc
143 Reorder List reorder-list.cc
142 Linked List Cycle II linked-list-cycle-ii.cc
141 Linked List Cycle linked-list-cycle.cc
140 Word Break II word-break-ii.cc
139 Word Break word-break.cc
138 Copy List with Random Pointer copy-list-with-random-pointer.cc
137 Single Number II single-number-ii.cc
136 Single Number single-number.cc
135 Candy candy.cc
134 Gas Station gas-station.cc
133 Clone Graph clone-graph.cc
132 Palindrome Partitioning II palindrome-partitioning-ii.cc
131 Palindrome Partitioning palindrome-partitioning.cc
130 Surrounded Regions surrounded-regions.cc
129 Sum Root to Leaf Numbers sum-root-to-leaf-numbers.cc
128 Longest Consecutive Sequence longest-consecutive-sequence.cc
127 Word Ladder word-ladder.cc
126 Word Ladder II word-ladder-ii.cc
125 Valid Palindrome valid-palindrome.cc
124 Binary Tree Maximum Path Sum binary-tree-maximum-path-sum.cc
123 Best Time to Buy and Sell Stock III best-time-to-buy-and-sell-stock-iii.cc
122 Best Time to Buy and Sell Stock II best-time-to-buy-and-sell-stock-ii.cc
121 Best Time to Buy and Sell Stock best-time-to-buy-and-sell-stock.cc
120 Triangle triangle.cc
119 Pascal's Triangle II pascals-triangle-ii.cc
118 Pascal's Triangle pascals-triangle.cc
117 Populating Next Right Pointers in Each Node II populating-next-right-pointers-in-each-node-ii.cc
116 Populating Next Right Pointers in Each Node populating-next-right-pointers-in-each-node.cc
115 Distinct Subsequences distinct-subsequences.cc
114 Flatten Binary Tree to Linked List flatten-binary-tree-to-linked-list.cc
113 Path Sum II path-sum-ii.cc
112 Path Sum path-sum.cc
111 Minimum Depth of Binary Tree minimum-depth-of-binary-tree.cc
110 Balanced Binary Tree balanced-binary-tree.cc
109 Convert Sorted List to Binary Search Tree convert-sorted-list-to-binary-search-tree.cc
108 Convert Sorted Array to Binary Search Tree convert-sorted-array-to-binary-search-tree.cc
107 Binary Tree Level Order Traversal II binary-tree-level-order-traversal-ii.cc
106 Construct Binary Tree from Inorder and Postorder Traversal construct-binary-tree-from-inorder-and-postorder-traversal.cc
105 Construct Binary Tree from Preorder and Inorder Traversal construct-binary-tree-from-preorder-and-inorder-traversal.cc
104 Maximum Depth of Binary Tree maximum-depth-of-binary-tree.cc
103 Binary Tree Zigzag Level Order Traversal binary-tree-zigzag-level-order-traversal.cc
102 Binary Tree Level Order Traversal binary-tree-level-order-traversal.cc
101 Symmetric Tree symmetric-tree.cc
100 Same Tree same-tree.cc
99 Recover Binary Search Tree recover-binary-search-tree.cc
98 Validate Binary Search Tree validate-binary-search-tree.cc
97 Interleaving String interleaving-string.cc
96 Unique Binary Search Trees unique-binary-search-trees.cc
95 Unique Binary Search Trees II unique-binary-search-trees-ii.cc
94 Binary Tree Inorder Traversal binary-tree-inorder-traversal.cc
93 Restore IP Addresses restore-ip-addresses.cc
92 Reverse Linked List II reverse-linked-list-ii.cc
91 Decode Ways decode-ways.cc
90 Subsets II subsets-ii.cc
89 Gray Code gray-code.cc
88 Merge Sorted Array merge-sorted-array.cc
87 Scramble String scramble-string.cc
86 Partition List partition-list.cc
85 Maximal Rectangle maximal-rectangle.cc
84 Largest Rectangle in Histogram largest-rectangle-in-histogram.cc
83 Remove Duplicates from Sorted List remove-duplicates-from-sorted-list.cc
82 Remove Duplicates from Sorted List II remove-duplicates-from-sorted-list-ii.cc
81 Search in Rotated Sorted Array II search-in-rotated-sorted-array-ii.cc
80 Remove Duplicates from Sorted Array II remove-duplicates-from-sorted-array-ii.cc
79 Word Search word-search.cc
78 Subsets subsets.cc
77 Combinations combinations.cc
76 Minimum Window Substring minimum-window-substring.cc
75 Sort Colors sort-colors.cc
74 Search a 2D Matrix search-a-2d-matrix.cc
73 Set Matrix Zeroes set-matrix-zeroes.cc
72 Edit Distance edit-distance.cc
71 Simplify Path simplify-path.cc
70 Climbing Stairs climbing-stairs.cc
69 Sqrt(x) sqrtx.cc
68 Text Justification text-justification.cc
67 Add Binary add-binary.cc
66 Plus One plus-one.cc
65 Valid Number valid-number.cc
64 Minimum Path Sum minimum-path-sum.cc
63 Unique Paths II unique-paths-ii.cc
62 Unique Paths unique-paths.cc
61 Rotate List rotate-list.cc
60 Permutation Sequence permutation-sequence.cc
59 Spiral Matrix II spiral-matrix-ii.cc
58 Length of Last Word length-of-last-word.cc
57 Insert Interval insert-interval.cc
56 Merge Intervals merge-intervals.cc
55 Jump Game jump-game.cc
54 Spiral Matrix spiral-matrix.cc
53 Maximum Subarray maximum-subarray.cc
52 N-Queens II n-queens-ii.cc
51 N-Queens n-queens.cc
50 Pow(x, n) powx-n.cc
49 Group Anagrams anagrams.cc
48 Rotate Image rotate-image.cc
47 Permutations II permutations-ii.cc
46 Permutations permutations.cc
45 Jump Game II jump-game-ii.cc
44 Wildcard Matching wildcard-matching.cc
43 Multiply Strings multiply-strings.cc
42 Trapping Rain Water trapping-rain-water.cc
41 First Missing Positive first-missing-positive.cc
40 Combination Sum II combination-sum-ii.cc
39 Combination Sum combination-sum.cc
38 Count and Say count-and-say.cc
37 Sudoku Solver sudoku-solver.cc
36 Valid Sudoku valid-sudoku.cc
35 Search Insert Position search-insert-position.cc
34 Search for a Range search-for-a-range.cc
33 Search in Rotated Sorted Array search-in-rotated-sorted-array.cc
32 Longest Valid Parentheses longest-valid-parentheses.cc
31 Next Permutation next-permutation.cc
30 Substring with Concatenation of All Words substring-with-concatenation-of-all-words.cc
29 Divide Two Integers divide-two-integers.cc
28 Implement strStr() implement-strstr.cc
27 Remove Element remove-element.cc
26 Remove Duplicates from Sorted Array remove-duplicates-from-sorted-array.cc
25 Reverse Nodes in k-Group reverse-nodes-in-k-group.cc
24 Swap Nodes in Pairs swap-nodes-in-pairs.cc
23 Merge k Sorted Lists merge-k-sorted-lists.cc
22 Generate Parentheses generate-parentheses.cc
21 Merge Two Sorted Lists merge-two-sorted-lists.cc
20 Valid Parentheses valid-parentheses.cc
19 Remove Nth Node From End of List remove-nth-node-from-end-of-list.cc
18 4Sum 4sum.cc
17 Letter Combinations of a Phone Number letter-combinations-of-a-phone-number.cc
16 3Sum Closest 3sum-closest.cc
15 3Sum 3sum.cc
14 Longest Common Prefix longest-common-prefix.cc
13 Roman to Integer roman-to-integer.cc
12 Integer to Roman integer-to-roman.cc
11 Container With Most Water container-with-most-water.cc
10 Regular Expression Matching regular-expression-matching.cc
9 Palindrome Number palindrome-number.cc
8 String to Integer (atoi) string-to-integer-atoi.cc
7 Reverse Integer reverse-integer.cc
6 ZigZag Conversion zigzag-conversion.cc
5 Longest Palindromic Substring longest-palindromic-substring.cc
4 Median of Two Sorted Arrays median-of-two-sorted-arrays.cc
3 Longest Substring Without Repeating Characters longest-substring-without-repeating-characters.cc
2 Add Two Numbers add-two-numbers.cc
1 Two Sum two-sum.cc

About

Solutions of LeetCode Online Judge for ruyiwei

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 100.0%