Skip to content

Cloving/Cpp-LeetCode

Repository files navigation

愿此行繁花似锦,再相逢依旧如故

本项目为leetCode习题解答

  1. 算法采用Cpp编写,所有提交程序均AC,放心食用;
  2. 多数题目一般采用了两种或两种以上的方法解答;

001~100

Index Title Tag Type
1 Two Sum Array, Hash Table Easy
2 Add Two Numbers Linked List, Math Medium
5 Longest Palindromic Substring String, Dynamic Programming Medium
7 Reverse Integer Math Easy
8 String to Integer (atoi) Math, String Medium
9 Palindrome Number Math Easy
11 Container With Most Water Array, Two Pointers Medium
12 Integer to Roman Math, String Medium
13 Roman to Integer Math, String Easy
14 Longest Common Prefix String Easy
15 3Sum Array, Two Pointers Medium
16 3Sum Closest Array, Two Pointers Medium
19 Remove Nth Node From End of List Linked List, Two Pointers Medium
20 Valid Parentheses Stack, String Easy
21 Merge Two Sorted Lists Linked List Easy
22 Generate Parentheses Backtracking, String Medium
24 Swap Nodes in Pairs Linked List Medium
26 Remove Duplicates from Sorted Array Array, Two Pointers Easy
27 Remove Element Array, Two Pointers Easy
28 Implement strStr() Two Pointers, String Easy
33 Search in Rotated Sorted Array Array, Binary Search Medium
34 Find First and Last Position of Element in Sorted Array Array, Binary Search Medium
35 Search Insert Position Array, Binary Search Easy
36 Vaild Sudoku Hash Table Medium
38 Count and Say String Easy
48 Rotate Image Array Medium
53 Maximum Subarray Array, Divide and Conquer, Dynamic Programming Easy
54 Spiral Matrix Array Medium
56 Merge Intervals Sort, Array Medium
58 Length of Last Word String Easy
59 Spiral Matrix II Array Medium
62 Unique Paths Array, Dynamic Programming Medium
66 Plus One Array, Math Easy
67 Add Binary Math, String Easy
69 Valid Perfect Square Math, Binary Search Easy
70 Climbing Stairs Array Easy
74 Search a 2D Matrix Array, Binary Search Medium
75 Sort Colors Sort, Array, Two Pointers Medium
80 Remove duplicates from sorted arrays II Array, Two Pointers Medium
81 Search in Rotated Sorted Array II Array, Binary Search Medium
82 Remove Duplicates from Sorted List Ⅱ Linked List Medium
83 Remove Duplicates from Sorted List Linked List Easy
86 Partition List Linked List, Two Pointers Medium
88 Merge Sorted Array Array, Two Pointers Easy
92 Reverse Linked List II Linked List Medium
94 Binary Tree Inorder Traversal Stack, Tree, Hash Table Medium
100 Same Tree Tree, DFS Easy

101~200

Index Title Tag Type
101 Symmetric Tree Tree, BFS, DFS Easy
102 Binary Tree Level Order Traversal Tree, BFS Medium
104 Maximum Depth of Binary Tree Tree, DFS Easy
107 Binary Tree Level Order Traversal II Tree, BFS Easy
108 Convert Sorted Array to Binary Search Tree Tree, DFS Easy
109 Convert Sorted List to Binary Search Tree Linked List, DFS Medium
110 Balanced Binary Tree Tree, DFS Easy
118 Pascal's Triangle Array Easy
119 Pascal's Triangle Ⅱ Array Easy
121 Best Time to Buy and Sell Stock Array, Dynamic Programming Easy
122 Best Time to Buy and Sell Stock II Array, Greedy Easy
125 Valid Palindrome Two Pointers, String Easy
136 Single Number Bit Manipulation, Hash Table Easy
138 Copy List with Random Pointer Hash Table, Linked List Medium
141 Linked List Cycle Linked List, Two Pointers Easy
142 Linked List Cycle II Linked List, Two Pointers Medium
143 Reorder List Linked List Medium
144 Binary Tree Preorder Traversal Stack, Tree Medium
145 Binary Tree Postorder Traversal Stack, Tree Hard
147 Insertion Sort List Linked List, Sort Medium
148 Sort List Linked List, Sort Medium
151 Reverse Words in a String String Medium
160 Intersection of Two Linked Lists Linked List Easy
162 Find Peak Element Array, Binary Search Medium
167 Two Sum - Input array is sorted Ⅱ Array, Two Pointers, Binary Search Easy
169 Majority Element Bit Manipulation, Array, Divide and Conquer Easy
179 Largest Number Sort Medium
189 Rotate Array Array Easy

201~300

Index Title Tag Type
203 Remove Linked List Elements Linked List Easy
209 Minimum Size Subarray Sum Array, Two Pointers, Binary Search Medium
215 Kth Largest Element in an array Heap, Divide and Conquer Medium
217 Contains Duplicate Array, Hash Table Easy
226 [ Invert Binary Tree][226] Tree Easy
229 Majority Element II Array Medium
238 Product of Array Except Self Array Medium
278 First Bad Version Binary Search Easy
283 Move Zeroes Array, Two Pointers Easy
287 Find the Duplicate Number Array, Two Pointers, Binary Search Medium
292 Nim Game Brainteaser Easy

301~400

Index Title Tag Type
328 Odd Even Linked List Linked List Medium
344 Reverse String Two Pointers, String Easy
345 Reverse a Vowels of a String Two Pointers, String Easy
347 Top K Frequent Elements Heap, Hash Table Medium
349 Intersection of Two Arrays Sort, Hash Table, Two Pointers, Binary Search Easy
350 Intersection of Two Arrays Ⅱ Sort, Hash Table, Two Pointers, Binary Search Easy
367 Valid Perfect Square Math, Binary Search Easy
374 Guess Number Higher or Lower Binary Search Easy

401~500

Index Title Tag Type
443 String Compression String Easy
445 Add Two Numbers II Linked List Medium
459 Repeated Substring Pattern String Easy
485 Max Consecutive Ones Array Easy
496 Next Greater Element I Stack Easy

501~600

Index Title Tag Type
503 Next Greater Element II Stack Medium
556 Next Greater Element III String Medium
557 Reverse Words in a String III String Easy
561 Array Partition Ⅰ Array Easy

601~700

Index Title Tag Type
637 Average of Levels in Binary Tree Tree Easy
695 Max Area of Island Depth-first Search, Array Easy

701~800

Index Title Tag Type
704 Binary Search Binary Search Easy
724 Find Pivot Index Array Easy
747 Largest Number At Least Twice of Others Array Easy

801~900

Index Title Tag Type
852 Peak Index in a Mountain Array Binary Search Easy
876 Middle of the Linked List Linked List Easy

901~1000

Index Title Tag Type
915 Partition Array into Disjoint Intervals Array Medium

About

Data Structure And Algorithm

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages