Skip to content

zeng-zc/leetcode

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Summary

Codes I wrote to solve the problems on leetcode.

Most of the codes in Algorithm section are written in C++ and C,

and a few in Python, while the Shell section is in Perl.

A lot of the problems are solved in several ways, i.e. the naiive one and improved one.

Advices and discussions are welcome to Email to [email protected].

Enjoy it.

Catalogue

No. # Title Difficulty Solution
1 1 Two Sum Easy C++
2 2 Add Two Numbers Medium C++
3 3 Longest Substring Without Repeating Characters Medium C
4 7 Reverse Integer Easy C
5 8 String to Integer (atoi) Easy C
6 9 Palindrome Number Easy C
7 14 Longest Common Prefix Easy C++
8 17 Letter Combinations of a Phone Number Medium C++
9 19 Remove Nth Node From End of List Easy C
10 20 Valid Parentheses Easy C++
11 21 Merge Two Sorted Lists Easy C
12 22 Generate Parentheses Medium C++
13 24 Swap Nodes in Pairs Easy C
14 25 Reverse Nodes in k-Group Hard C++
15 25 Reverse Nodes in k-Group Hard C
16 26 Remove Duplicates from Sorted Array Easy C
17 27 Remove Element Easy C
18 28 Implement strStr() Easy C
19 33 Search in Rotated Sorted Array Hard C
20 33 Search in Rotated Sorted Array Hard C++
21 33 Search in Rotated Sorted Array Hard Python
22 33 Search in Rotated Sorted Array Hard C
23 35 Search Insert Position Medium C
24 36 Valid Sudoku Easy C++
25 37 Sudoku Solver Hard C++
26 39 Combination Sum Medium C++
27 40 Combination Sum II Medium C++
28 43 Multiply Strings Medium C++
29 46 Permutations Medium C++
30 51 N-Queens Hard C++
31 52 N-Queens II Hard C++
32 53 Maximum Subarray Medium C
33 55 Jump Game Medium C++
34 58 Length of Last Word Easy C
35 61 Rotate List Medium C
36 62 Unique Paths Medium C
37 66 Plus One Easy C++
38 67 Add Binary Easy C++
39 70 Climbing Stairs Easy C++
40 70 Climbing Stairs Easy C
41 73 Set Matrix Zeroes Medium C++
42 77 Combinations Medium C++
43 78 Subsets Medium C++
44 82 Remove Duplicates from Sorted List II Medium C
45 83 Remove Duplicates from Sorted List Easy C++
46 86 Partition List Medium C
47 88 Merge Sorted Array Easy C
48 90 Subsets II Medium C++
49 92 Reverse Linked List II Medium C
50 94 Binary Tree Inorder Traversal Medium C++
51 95 Unique Binary Search Trees II Medium C++
52 96 Unique Binary Search Trees Medium C++
53 100 Same Tree Easy C
54 101 Symmetric Tree Easy C
55 102 Binary Tree Level Order Traversal Easy C++
56 103 Binary Tree Zigzag Level Order Traversal Medium C++
57 104 Maximum Depth of Binary Tree Easy C
58 105 Construct Binary Tree from Preorder and Inorder Traversal Medium C++
59 106 Construct Binary Tree from Inorder and Postorder Traversal Medium C++
60 107 Binary Tree Level Order Traversal II Easy C++
61 108 Convert Sorted Array to Binary Search Tree Medium C++
62 109 Convert Sorted List to Binary Search Tree Medium C++
63 110 Balanced Binary Tree Easy C
64 111 Minimum Depth of Binary Tree Easy C
65 112 Path Sum Easy C++
66 113 Path Sum II Medium C++
67 118 Pascal's Triangle Easy Python
68 118 Pascal's Triangle Easy C++
69 119 Pascal's Triangle II Easy C++
70 120 Triangle Medium C++
71 125 Valid Palindrome Easy C
72 129 Sum Root to Leaf Numbers Medium C++
73 136 Single Number Easy Python
74 136 Single Number Easy C
75 139 Word Break Medium C++
76 141 Linked List Cycle Easy C
77 141 Linked List Cycle Easy C++
78 142 Linked List Cycle II Medium C
79 144 Binary Tree Preorder Traversal Medium C++
80 145 Binary Tree Postorder Traversal Hard C++
81 147 Insertion Sort List Medium C
82 147 Insertion Sort List Medium C++
83 148 Sort List Medium C
84 150 Evaluate Reverse Polish Notation Medium C++
85 151 Reverse Words in a String Medium C++
86 151 Reverse Words in a String Medium C
87 153 Find Minimum in Rotated Sorted Array Medium C
88 153 Find Minimum in Rotated Sorted Array Medium Python
89 155 Min Stack Easy C++
90 160 Intersection of Two Linked Lists Easy C
91 168 Excel Sheet Column Title Easy C++
92 168 Excel Sheet Column Title Easy C
93 169 Majority Element Easy C
94 169 Majority Element Easy C++
95 171 Excel Sheet Column Number Easy C
96 172 Factorial Trailing Zeroes Easy C
97 190 Reverse Bits Easy C
98 191 Number of 1 Bits Easy C
99 192 Word Frequency Medium Shell
100 193 Valid Phone Numbers Easy Shell
101 194 Transpose File Medium Shell
102 194 Transpose File Medium Perl
103 195 Tenth Line Easy Shell
104 198 House Robber Easy C
105 199 Binary Tree Right Side View Medium C++
106 201 Bitwise AND of Numbers Range Medium C++
107 202 Happy Number Easy C++
108 203 Remove Linked List Elements Easy C
109 204 Count Primes Easy C++
110 205 Isomorphic Strings Easy C++
111 206 Reverse Linked List Easy C
112 215 Kth Largest Element in an Array Medium C
113 216 Combination Sum III Medium C++
114 217 Contains Duplicate Easy C++
115 223 Rectangle Area Easy C++
116 225 Implement Stack using Queues Easy C++
117 226 Invert Binary Tree Easy C
118 228 Summary Ranges Medium C++
119 230 Kth Smallest Element in a BST Medium C++
120 231 Power of Two Easy C
121 232 Implement Queue using Stacks Easy C++
122 234 Palindrome Linked List Easy C++
123 235 Lowest Common Ancestor of a Binary Search Tree Easy C
124 237 Delete Node in a Linked List Easy C
125 238 Product of Array Except Self Medium C++
126 242 Valid Anagram Easy C
127 257 Binary Tree Paths Easy C++
128 258 Add Digits Easy Python
129 258 Add Digits Easy C
130 263 Ugly Number Easy C
131 264 Ugly Number II Medium C++
132 268 Missing Number Medium C
133 278 First Bad Version Easy C++
134 290 Word Pattern Easy Python
135 290 Word Pattern Easy C++
136 292 Nim Game Easy C++
137 344 Reverse String Easy C++
138 345 Reverse Vowels of a String Easy C++
139 349 Intersection of Two Arrays Easy C++
140 350 Intersection of Two Arrays II Easy C++
141 374 Guess Number Higher or Lower Easy C++
142 387 First Unique Character in a String Easy C++
143 387 First Unique Character in a String Easy Python
144 389 Find the Difference Easy Python
145 389 Find the Difference Easy C++
146 392 Is Subsequence Medium C++
147 392 Is Subsequence Medium Python
148 404 Sum of Left Leaves Easy C++
149 404 Sum of Left Leaves Easy Python

About

leetcode solutions

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published