Skip to content
No description, website, or topics provided.
Python Java Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.ipynb_checkpoints
001
002
003
005
006
008
011
014
015
016
017
019
020
021
022
023
024
026
027
028
031
033
038
039
042
046
047
049
050
052
053
056
058
062
066
067
068
070
071
075
078
079
082
083
084
086
088
090
091
092
093
094
098
100
1007
1008
101
102
1021
1022
103
1034
104
105
1050
1051
106
1064
1068
1069
107
1079
108
1082
1085
1086
109
110
1108
111
1119
112
1123
1134
1137
114
1145
116
1165
117
1173
118
1180
119
1207
121
1221
125
1252
127
133
136
137
138
139
141
142
143
144
145
147
148
150
151
153
155
160
165
167
169
170
173
179
189
190
191
198
199
200
202
203
204
205
206
207
208
209
211
215
217
219
225
226
231
232
234
235
236
237
238
240
241
243
244
246
247
249
250
252
253
257
259
263
264
266
268
270
271
278
281
283
288
293
299
300
313
314
325
326
328
338
339
341
342
344
346
347
349
350
359
371
374
378
380
387
394
399
401
404
412
422
426
429
434
437
439
443
448
455
459
461
475
482
485
496
498
501
511
521
530
535
538
543
544
557
559
560
561
563
572
581
589
590
595
599
604
606
609
613
617
620
621
622
627
637
641
645
648
653
654
655
657
669
671
674
677
680
681
682
687
690
692
695
700
701
705
706
709
716
721
724
728
733
744
746
747
760
762
771
776
783
784
790
801
804
811
814
819
821
832
840
844
845
849
852
855
860
863
867
872
892
894
896
897
904
905
908
921
922
926
929
930
932
933
937
938
946
961
965
977
981
993
998
classical_algorithm
play
.DS_Store
README.md
count.py

README.md

LeetCode solutions in Python3.

Table of Contents

Complexity

Time & Space Complexity

Data Structure

Name. Note
BST NOTE
Graph NOTE
Trie NOTE
Union Find NOTE
Queue NOTE

Classical Algorithm

Name. Note
KMP NOTE
Recursion NOTE
Dijkstra NOTE
Floyd NOTE
BinarySearch NOTE
Sort NOTE
Heap and HeapSort NOTE
Greedy NOTE
Dynamic Programming NOTE
Eight Queue Backtracking
Hamilton circuit Backtracking
BFS(unweighted graph shortest path) NOTE
Tree Traverse NOTE

Bit Manipulation

NO. Title Solution Note Difficulty Time Space Tag
No.136 Single Number Solution Note Easy O(n) O(1)
No.191 Number of 1 Bits Solution Note Easy O(1) O(1)
No.190 Reverse Bits Solution Note Easy O(1) O(1)
No.231 Power of Two Solution Note Easy O(1) O(1)
No.342 Power of Four Solution Note Easy O(1) O(1)
No.401 Binary Watch Solution Note Easy O(1) O(1)
No.461 Hamming Distance Solution Note Easy O(1) O(1)
No.645 Set Mismatch Solution Note Easy O(n) O(1)
No.137 Single NumberII Solution Note Medium O(n) O(1)
No.762 Prime Number of Set Bits in Binary Representation Solution Note Medium O(1) O(1)
No.371 Sum of Two Integers Solution Note Easy O(1) O(1)
No.268 Missing Number Solution Note Easy O(n) O(1) ,Math
No.1085 Sum of Digits in the Minimum Number Solution Note Easy O(n) O(1)
No.728 Self Dividing Numbers Solution Note Easy O(nm) O(1)

Array

NO. Title Solution Note Difficulty Time Space Tag
No.026 Remove Duplicates from Sorted Array Solution Note Easy O(n) O(1) Array
No.027 Remove Element Solution Note Easy O(n) O(1)
No.066 Plus One Solution Note Easy O(n) O(1)
No.118 Pascal's Triangle Solution Note Easy O(n^2) O(1)
No.119 Pascal's Triangle II Solution Note Easy O(n^2) O(1)
No.121 Best Time to Buy and Sell Stock Solution Note Easy O(n) O(1) Array
No.169 Majority Element Solution Note Easy O(n) O(1)
No.189 Rotate Array Solution Note Easy O(n) O(1)
No.905 Sort Array By Parity Solution Note Easy O(n) O(1)
No.896 Monotonic Array Solution Note Easy O(n) O(1)
No.243 Shortest Word Distance Solution Note Easy O(n) O(1)
No.448 Find All Numbers Disappeared in an Array Solution Note Easy O(n) O(1)
No.821 Shortest Distance to a Character Solution Note Easy O(n) O(n)
No.001 Two Sum Solution Note Easy O(n) O(n)
No.167 Two Sum II Solution Note Easy O(n) O(1)
No.170 Two Sum III Solution Note Easy O(n) O(1)
No.922 Sort Array By Parity II Solution Note Easy O(n) O(1) two pointer
No.867 Transpose Matrix Solution Note Easy O(n) O(n)
No.860 Lemonade Change Solution Note Easy O(n) O(n)
No.849 Maximize Distance to Closest Person Solution Note Easy O(n) O(1)
No.840 Magic Squares In Grid Solution Note Easy O(n) O(1)
No.283 Move Zeroes Solution Note Easy O(n) O(1)
No.015 3sum Solution Note Easy O(n^2) O(n)
No.209 Minimum Size Subarray Sum Solution Note Medium O(n) O(1) two pointer
No.560 Subarray Sum Equals k Solution Note Medium O(n) O(1) prefix sum
No.325 Maximum Size Subarray Sum Equals k Solution Note Medium O(n) O(n) prefix sum
No.930 Binary Subarrays With Sum Solution Note Medium O(n) O(n) prefix sum
No.011 Container With Most Water Solution Note Medium O(n) O(1) two pointer
No.904 Fruit Into Baskets Solution Note Medium O(n) O(1) two pointer
No.674 Longest Continuous Increasing Subsequence Solution Note Easy O(n) O(1)
No.031 Next Permutation Solution Note Medium O(nlogn) O(1)
No.422 Valid Word Square Solution Note Easy O(n^2) O(1)
No.349 Intersection of Two Arrays Solution Note Easy O(n) O(1)
No.724 Find Pivot Index Solution Note Easy O(n) O(1)
No.747 Largest Number At Least Twice of Others Solution Note Easy O(n) O(1)
No.498 Diagonal Traverse Solution Note Medium O(n) O(n)
No.561 Array Partition I Solution Note Easy O(nlogn) O(1)
No.485 Max Consecutive Ones Solution Note Easy O(n) O(1)
No.1086 High Five Solution Note Easy O(n^2logn) O(n)
No.1064 Fixed Point Solution Note Easy O(n) O(n)
No.832 Fixed Point Solution Note Easy O(n) O(n)
No.053 Maximum Subarray Solution Note Easy O(n) O(n) cum sum
No.240 Search a 2D Matrix II Solution Note Easy O(N+M) O(1)
No.961 N-Repeated Element in Size 2N Array Solution Note Easy O(n) O(n)
No.977 Squares of a Sorted Array Solution Note Easy O(n) O(n)
No.016 3Sum Closest Solution Note Medium O(n^2) O(1)
No.1207 Unique Number of Occurrences Solution Note Easy O(n) O(n)
No.338 Counting Bits Solution Note Medium O(n) O(n)
No.259 3sum Smaller Solution Note Medium O(n^2) O(1)
No.1007 Minimum Domino Rotations For Equal Row Solution Note Medium O(n) O(1)

String

NO. Title Solution Note Difficulty Time Space Tag
No.014 Longest Common Prefix Solution Note Easy O(n) O(1) String
No.028 Implement strStr() Solution Note Easy O(n + k) O(1) kmp
No.038 Count and Say Solution Note Easy O(n * 2) O(1) iteration
No.058 Length of Last Word Solution Note Easy O(n) O(1) count from back
No.067 Add Binary Solution Note Easy O(n) O(1) construction number
No.125 Valid Palindrome Solution Note Easy O(n) O(n)
No.165 Compare Version Numbers Solution Note Easy O(n) O(n)
No.434 Number of Segments in a String Solution Note Easy O(n) O(1)
No.443 String Compression Solution Note Easy O(n) O(1) many pointer
No.459 Repeated Substring Pattern Solution Note Easy O(n) O(1) kmp
No.006 ZigZag Conversion Solution Note Meduim O(n * k) O(1) String
No.521 Longest Uncommon Subsequence I Solution Note Easy O(n * k) O(1) String
No.680 Valid Palindrome II Solution Note Easy O(n) O(1) String
No.681 Next Closest Time Solution Note Medium O(4^4) O(1) DFS
No.771 Jewels and Stones Solution Note Easy O(n) O(n)
No.482 License Key Formatting Solution Note Easy O(n) O(n)
No.344 Reverse String Solution Note Easy O(n) O(1)
No.412 Fizz Buzz Solution Note Easy O(n) O(1)
No.005 Longest Palindromic Substring Solution Note Medium O(n^2) O(1)
No.819 Most Common Word Solution Note Easy O(n) O(n)
No.929 Unique Email Addresses Solution Note Easy O(n^2) O(n)
No.535 Encode and Decode TinyURL Solution Note Meduim O(n) O(n)
No.271 Encode and Decode Strings Solution Note Meduim O(n) O(n)
No.003 Longest Substring Without Repeating Characters Solution Note Meduim O(n) O(n)
No.293 Flip Game Solution Note Easy O(n) O(n)
No.604 Design Compressed String Iterator Solution Note Easy O(n) O(n) Iterator
No.008 String to Integer (atoi) Solution Note Meduim O(n) O(n)
No.151 Reverse Words in a String Solution Note Meduim O(n) O(n)
No.557 Reverse Words in a String III Solution Note Easy O(n) O(1)
No.1108 Defanging an IP Address Solution Note Easy O(n) O(1)
No.1180 Count Substrings with Only One Distinct Letter Solution Note Easy O(n) O(1)
No.1134 Armstrong Number Solution Note Easy O(n) O(1)
No.709 To Lower Case Solution Note Easy O(n) O(1)
No.657 Robot Return to Origin Solution Note Easy O(n) O(n)
No.1221 Split a String in Balanced Strings Solution Note Easy O(n) O(1)

Linked List

NO. Title Solution Note Difficulty Time Space Tag
No.021 Merge Two Sorted Lists Solution Note Easy O(n) O(1) guard node
No.024 Swap Nodes in Pairs Solution Note Medium O(n) O(1) watch end
No.083 Remove Duplicates from Sorted List Solution Note Easy O(n) O(1) two pointer
No.160 Intersection of Two Linked Lists Solution Note Easy O(n) O(1)
No.203 Remove Linked List Elements Solution Note Easy O(n) O(1)
No.237 Delete Node in a Linked List Solution Note Easy O(1) O(1) tricky,del
No.234 Palindrome Linked List Solution Note Meduim O(1) O(1) slow,quick pointer
No.206 Reverse Linked List Solution Note Easy O(n) O(1) reverse
No.002 Add Two Numbers Solution Note Medium O(n) O(1)
No.019 Remove Nth Node From End of List Solution Note Medium O(n) O(1) quick slow pointer
No.141 Linked List Cycle Solution Note Easy O(n) O(1) quick slow pointer
No.142 Linked List CycleII Solution Note Medium O(n) O(1) quick slow pointer
No.023 Merge k Sorted Lists Solution Note Hard O(nlogn) O(nk)
No.138 Copy List with Random Pointer Solution Note Medium O(n) O(n)
No.061 Rotate List Solution Note Medium O(n) O(n)
No.082 Remove Duplicates from Sorted List II Note Medium O(n) O(n)
No.086 Partition List Note Medium O(n) O(n)
No.092 Reverse Linked List II Note Medium O(n) O(n)
No.143 Reorder List Note Medium O(n) O(n)

Stack

NO. Title Solution Note Difficulty Time Space Tag
No.020 Valid Parentheses Solution Note Easy O(n) O(1)
No.844 Backspace String Compare Solution Note Easy O(M+N) O(1)
No.155 Min Stack Solution Note Easy O(1) O(1)
No.173 Binary Search Tree Iterator Solution Note Medium O(n) O(1)
No.232 Implement Queue using Stacks Solution Note Easy O(n) O(1)
No.682 Baseball Game Solution Note Easy O(n) O(1)
No.056 Merge Intervals Solution Note Medium O(nlogn) O(n)
No.394 Decode String Solution Note Medium O(n) O(n)
No.921 Minimum Add to Make Parentheses Valid Solution Note Medium O(n) O(n)
No.339 Nested List Weight Sum Solution Note Easy O(n) O(1) DFS
No.716 Max Stack Solution Note Easy O(n) O(1) DFS
No.946 Validate Stack Sequences Solution Note Medium O(n) O(n)
No.071 Simplify Path Solution Note Medium O(n) O(n)
No.150 Evaluate Reverse Polish Notation Solution Note Medium O(n) O(n)
No.225 Implement Stack using Queues Solution Note Easy O(n) O(n)
No.341 Flatten Nested List Iterator Solution Note Easy O(n) O(n)
No.439 Ternary Expression Parser Solution Note Medium O(n) O(n)
No.042 Trapping Rain Water Solution Note Hard O(n) O(n)
No.084 Largest Rectangle in Histogram Solution Note Hard O(n) O(n)
No.496 Next Greater Element I Solution Note Easy O(n) O(n)
No.1021 Remove Outermost Parentheses Solution Note Easy O(n) O(n)

Recursion

NO. Title Solution Note Difficulty Time Space Tag
No.101 Symmetric Tree Solution Note Easy O(n) O(h)
No.872 Leaf-Similar Trees Solution Note Easy O(n) O(n)
No.104 Maximum Depth of Binary Tree Solution Note Easy O(logn) O(1)
No.110 Balanced Binary Tree Solution Note Easy O(logn) O(1)
No.111 Minimum Depth of Binary Tree Solution Note Easy O(logn) O(1)
No.404 Sum of Left Leaves Solution Note Easy O(logn) O(1)
No.669 Trim a Binary Search Tree Solution Note Easy O(logn) O(1)
No.671 Second Minimum Node In a Binary Tree Solution Note Easy O(logn) O(1)
No.894 All Possible Full Binary Trees Solution Note Easy O(2^N) O(n)
No.1137 N-th Tribonacci Number Solution Note Easy O(n) O(n)
No.544 Output Contest Matches Solution Note Medium O(n) O(n)
No.247 Strobogrammatic Number II Solution Note Medium O(n) O(n)
No.721 Accounts Merge Solution Note Medium O(n^2) O(n)

Queue

NO. Title Solution Note Difficulty Time Space Tag
No.346 Moving Average from Data Stream Solution Note Easy O(1) O(w)
No.281 Zigzag Iterator Solution Note Medium O(n) O(n)
No.127 Word Ladder Solution Note Medium O(n) O(n)
No.622 Design Circular Queue Solution Note Medium O(n) O(n)
No.641 Design Circular Deque Solution Note Medium O(n) O(n)
No.933 Number of Recent Calls Solution Note Easy O(n) O(n)

Binary Tree

NO. Title Solution Note Difficulty Time Space Tag
No.226 Invert Binary Tree Solution Note Easy O(logn) O(h)
No.538 Convert BST to Greater Tree Solution Note Easy O(n) O(h)
No.543 Diameter of Binary Tree Solution Note Easy O(n) O(h)
No.687 Longest Univalue Path Solution Note Easy O(n) O(h)
No.897 Increasing Order Search Tree Solution Note Easy O(n) O(h)
No.617 Merge Two Binary Trees Solution Note Easy O(n) O(h)
No.606 Construct String from Binary Tree Solution Note Easy O(n) O(h)
No.572 Subtree of Another Tree Solution Note Easy O(n) O(h)
No.563 Binary Tree Tilt Solution Note Easy O(n^2)
No.094 Binary Tree Inorder Traversal Solution Note Medium O(n) O(n) Inorder Traversal
No.112 Path Sum Solution Note Easy O(n) O(1) DFS
No.257 Binary Tree Paths Solution Note Easy O(n) O(1) DFS
No.144 Binary Tree Preorder Traversal Solution Note Medium O(n) O(n) iteration traverse
No.145 Binary Tree Postorder Traversal Solution Note Hard O(n) O(n) iteration traverse
No.102 Binary Tree Level Order Traversal Solution Note Medium O(n) O(n) iteration traverse
No.250 Count Univalue Subtrees Solution Note Medium O(n) O(n)
No.106 Construct Binary Tree from Inorder and Postorder Traversal Solution Note Medium O(n) O(n) build tree
No.105 Construct Binary Tree from Inorder and Preorder Traversal Solution Note Medium O(n) O(n) build tree
No.116 Populating Next Right Pointers in Each Node Solution Note Medium O(n) O(n)
No.117 Populating Next Right Pointers in Each Node II Solution Note Medium O(n) O(n)
No.236 Lowest Common Ancestor of a Binary Tree Solution Note Medium O(n^2) O(n)
No.100 Same Tree Solution Note Medium O(n) O(1)
No.314 Binary Tree Vertical Order Traversal Solution Note Medium O(n) O(n)
No.637 Average of Levels in Binary Tree Solution Note Easy O(n) O(n)
No.103 Binary Tree Zigzag Level Order Traversal Solution Note Medium O(n) O(n)
No.114 Flatten Binary Tree to Linked List Solution Note Medium O(n) O(1) DFS
No.437 Path Sum III Solution Note Medium O(nlogn) O(1) DFS
No.965 Univalued Binary Tree Solution Note Easy O(n) O(1)
No.1022 Sum of Root To Leaf Binary Numbers Solution Note Easy O(n) O(1)
No.993 Cousins in Binary Tree Solution Note Easy O(n) O(1)
No.107 Binary Tree Level Order Traversal II Solution Note Easy O(n) O(n)
No.654 Maximum Binary Tree Solution Note Medium O(nlogn) O(n)
No.1008 Construct Binary Search Tree from Preorder Traversal Solution Note Medium O(nlogn) O(n)
No.701 Insert into a Binary Search Tree Solution Note Medium O(logn) O(n)
No.814 Binary Tree Pruning Solution Note Medium O(logn) O(n)
No.655 Print Binary Tree Solution Note Medium O(n) O(n)
No.988 Maximum Binary Tree II Solution Note Medium O(n) O(n)
No.1123 Lowest Common Ancestor of Deepest Leaves Solution Note Medium O(n) O(n)
No.199 Binary Tree Right Side View Solution Note Medium O(n) O(n)

Hash Table

NO. Title Solution Note Difficulty Time Space Tag
No.202 Happy Number Solution Note Easy O(n) O(n)
No.204 Count Primes Solution Note Easy O(n)
No.205 Isomorphic Strings Solution Note Easy O(n) O(n)
No.217 Contains Duplicate Solution Note Easy O(n) O(n)
No.219 Contains DuplicateII Solution Note Easy O(n) O(n)
No.246 Strobogrammatic Number Solution Note Easy O(n) O(n)
No.244 Shortest Word Distance II Solution Note Medium O(m+n) O(n)
No.249 Group Shifted Strings Solution Note Easy O(n) O(n)
No.266 Palindrome Permutation Solution Note Easy O(n) O(n)
No.288 Unique Word Abbreviation Solution Note Medium O(n) O(n)
No.299 Bulls and Cows Solution Note Medium O(n) O(n)
No.387 First Unique Character in a String Solution Note Easy O(n) O(n)
No.350 Intersection of Two Arrays II Solution Note Easy O(n) O(n)
No.049 Group Anagrams Solution Note Medium O(nklonk) O(n)
No.705 Design HashSet Solution Note Easy O(1) O(n)
No.599 Minimum Index Sum of Two Lists Solution Note Easy O(1) O(n)
No.359 Logger Rate Limiter Solution Note Easy O(1) O(n)
No.706 Design HashMap Solution Note Easy O(1) O(n)
No.380 Insert Delete GetRandom O(1) Solution Note Medium O(1) O(n)
No.981 Time Based Key-Value Store Solution Note Medium O(nlogn) O(n)
No.811 Subdomain Visit Count Solution Note Easy O(nm) O(n)
No.609 Find Duplicate File in System Solution Note Medium O(nk) O(n)
No.692 Top K Frequent Words Solution Note Medium O(nlogn) O(n)
No.1119 Remove Vowels from a String Solution Note Easy O(n) O(1)
No.1165 Single-Row Keyboard Solution Note Easy O(n) O(1)
No.760 Find Anagram Mappings Solution Note Easy O(n) O(n)
No.804 Unique Morse Code Words Solution Note Easy O(n) O(n)
No.1252 Cells with Odd Values in a Matrix Solution Note Easy O(n^2) O(n)

Sort

NO. Title Solution Note Difficulty Time Space Tag
No.088 Merge Sorted Array Solution Note Medium O(n+m) O(1) three pointer
No.252 Meeting Room Solution Note Easy O(nlogn) O(1)
No.075 Sort Colors Solution Note Medium O(n) O(1) tri pointer
No.147 Insertion Sort List Solution Note Medium O(n^2) O(1)
No.148 Sort List Solution Note Medium O(nlog) O(1) list merge sort
No.179 Largest Number Solution Note Medium O(nlogn) O(1) cmp_to_key
No.253 Meeting Rooms II Solution Note Medium O(nlogn) O(n)
No.347 Top K Frequent Elements Solution Note Medium O(nlogn) O(n)
No.581 Shortest Unsorted Continuous Subarray Solution Note Easy O(n) O(1)
No.1051 Height Checker Solution Note Easy O(nlogn) O(n)
No.207 Course Schedule Solution Note Meduim O(n) O(n)

Heap

NO. Title Solution Note Difficulty Time Space Tag
No.264 Ugly Number II Solution Note Medium O(n) O(1)
No.313 Super Ugly Number Solution Note Medium O(n * k) O(n * k)
No.378 Kth Smallest Element in a Sorted Matrix Solution Note Medium O(nklogn) O(n)
No.215 Kth Largest Element in an Array Solution Note Medium O(n+klogn) O(n)
No.937 K Closest Points to Origin Solution Note Medium O(klogn) O(n)

Binary Search

NO. Title Solution Note Difficulty Time Space Tag
No.855 Exam Room Solution Note Medium O(n) O(n)
No.374 Guess Number Higher or Lower Solution Note Easy O(logn) O(1)
No.475 Heaters Solution Note Easy O(nlogn) O(1)
No.744 Find Smallest Letter Greater Than Target Solution Note Easy O(n) O(1)
No.852 Peak Index in a Mountain Array Solution Note Easy O(n) O(1)
No.050 Pow(x, n) Solution Note Medium O(logn) O(1)
No.153 Find Minimum in Rotated Sorted Array Solution Note Medium O(logn) O(n)

Binary Search Tree

NO. Title Solution Note Difficulty Time Space Tag
No.235 Lowest Common Ancestor of a Binary Search Tree Solution Note Easy O(logn) O(1)
No.270 Closest Binary Search Tree Value Solution Note Easy O(logn) O(1)
No.653 Two Sum IV - Input is a BST Solution Note Easy O(n) O(n)
No.098 Validate Binary Search Tree Solution Note Easy O(n) O(n)
No.278 First Bad Version Solution Note Easy O(logn) O(1)
No.033 Search in Rotated Array Solution Note Medium O(logn) O(1)
No.173 Binary Search Tree Iterator Solution Note Medium O(1) O(h)
No.938 Range Sum of BST Solution Note Easy O(n) O(1)
No.700 Search in a Binary Search Tree Solution Note Easy O(n) O(1)
No.108 Convert Sorted Array to Binary Search Tree Solution Note Easy O(n) O(1)
No.530 Minimum Absolute Difference in BST Solution Note Easy O(n) O(1)
No.783 Minimum Distance Between BST Nodes Solution Note Easy O(n) O(1)
No.501 Find Mode in Binary Search Tree Solution Note Easy O(n) O(n)
No.776 Split BST Solution Note Medium O(logn) O(n)
No.426 Convert Binary Search Tree to Sorted Doubly Linked List Solution Note Medium O(n) O(1)

N-ary Tree

NO. Title Solution Note Difficulty Time Space Tag
No.589 N-ary Tree Preorder Traversal Solution Note Easy O(n) O(n)
No.590 N-ary Tree Postorder Traversal Solution Note Easy O(n) O(n)
No.429 N-ary Tree Levelorder Traversal Solution Note Easy O(n) O(n)
No.559 Maximum Depth of N-ary Tree Solution Note Easy O(n) O(n)
No.208 Implement Trie (Prefix Tree) Solution Note Medium O(k) O(n) trie
No.677 Map Sum Pairs Solution Note Medium trie
No.648 Replace Words Solution Note Medium O(n) O(n) trie
No.211 Add and Search Word - Data structure design Solution Note Medium O(n) O(n) trie

Math

NO. Title Solution Note Difficulty Time Space Tag
No.263 Ugly Number Solution Note Easy O(n) O(1)
No.238 Product of Array Except Self Solution Note Easy O(n) O(1)
No.621 Task Scheduler Solution Note Medium O(n) O(1)
No.326 Power of Three Solution Note Easy O(n) O(1) Math
No.892 Surface Area of 3D Shapes Solution Note Easy O(n) O(1) Math

Graph

NO. Title Solution Note Difficulty Time Space Tag
No.200 Number of Islands Solution Note Medium O(n) O(n) BFS
No.133 Clone Graph Solution Note Medium O(n) O(n) BFS
No.399 Evaluate Division Solution Note Medium O(n) O(n) DFS

Backtracking

NO. Title Solution Note Difficulty Time Space Tag
No.017 Letter Combinations of a Phone Number Solution Note Medium O(n) O(n)
No.093 Restore IP Addresses Solution Note Medium O(n^4) O(n)
No.078 Subset Solution Note Medium O(2^n) O(n)
No.078 SubsetII Solution Note Medium O(2^n) O(n)
No.046 Permutations Solution Note Medium O(n!) O(n)
No.047 PermutationsII Solution Note Medium O(n!) O(n)
No.079 Word Search Solution Note Medium O(n^2) O(n)
No.022 Generate Parentheses Solution Note Medium O(n!) O(n)
No.039 Combination Sum Solution Note Medium O(n!) O(n)
No.784 Combination Sum Solution Note Easy O(n*2) O(n) + O(n*2)
No.1079 Letter Tile Possibilities Solution Note Easy O(2*n) O(2*n)

DFS

NO. Title Solution Note Difficulty Time Space Tag
No.1145 Binary Tree Coloring Game Solution Note Medium O(n) O(1)
No.863 All Nodes Distance K in Binary Tree Solution Note Medium O(n) O(n)
No.1034 Coloring A Border Solution Note Medium O(n) O(n)

Greedy

NO. Title Solution Note Difficulty Time Space Tag
No.455 Assign Cookies Solution Note Easy O(nlogn) O(1)

Divide and Conquer

NO. Title Solution Note Difficulty Time Space Tag
No.932 Beautiful Array Solution Note Medium O(nlogn) O(n)
No.241 Different Ways to Add Parentheses Solution Note Medium O(nlogn) O(n)

Dynamic Programming

NO. Title Solution Note Difficulty Time Space Tag
No.091 Decode Ways Solution Note Medium O(n) O(1)
No.062 Unique Paths Solution Note Medium O(n^2) O(n)
No.070 Combing Stairs Solution Note Medium O(n) O(n)
No.926 Flip String to Monotone Increasing Solution Note Medium O(n) O(n)
No.845 Longest Mountain in Array Solution Note Medium O(n) O(1)
No.139 Longest Mountain in Array Solution Note Medium O(n) O(1)
No.300 Longest Increasing Subsequence Solution Note Medium O(nlogn) O(1)
No.198 House Robber Solution Note Easy O(n) O(n)
No.746 Min Cost Climbing Stairs Solution Note Easy O(n) O(n)
No.790 Domino and Tromino Tiling Solution Note Medium O(n) O(n)
No.801 Minimum Swaps To Make Sequences Increasing Solution Note Medium O(n) O(n)

SQL Schema

NO. Title Solution Note Difficulty Time Space Tag
No.1068 Product Sales Analysis I Solution Note Easy O(n*n) O(n*n)
No.1069 Product Sales Analysis II Solution Note Easy O(n) O(n)
No.511 Game Play Analysis I Solution Note Easy O(n) O(n)
No.595 Big Countries Solution Note Easy O(n) O(n)
No.1173 Immediate Food Delivery I Solution Note Easy O(n) O(n)
No.613 Shortest Distance in a Line Solution Note Easy O(n) O(n)
No.1050 Actors and Directors Who Cooperated At Least Three Times Solution Note Easy O(n) O(n)
No.627 Swap Salary Solution Note Easy O(n) O(1)
No.1082 Sales Analysis I Solution Note Easy O(n) O(1)
No.620 Not Boring Movies Solution Note Easy O(n) O(1)
You can’t perform that action at this time.