Skip to content

My CS learning : algorithm, data structure, and system design | #SE

Notifications You must be signed in to change notification settings

yennanliu/CS_basics

Repository files navigation

Star History Chart

Resource

Algorithms content

Database

Shell


Progress

Data Structure

# Title Solution Use case Comment Status
Linear
Array Py AGAIN*
Queue Py, JS AGAIN*
Stack Py, JS (linkedlist), JS (array) OK
Hash table Py, JS usually for improving time complexity B(O) via extra space complexity (time-space tradeoff) good basic AGAIN****
Linear, Pointer
LinkedList Py, JS, Java OK**
Doubly LinkedList Python, JS AGAIN
Non Linear, Pointer
Tree Py AGAIN**
Binary search Tree (BST) Python, JS, Scala, Java AGAIN
Binary Tree Py AGAIN**
Trie Py AGAIN
Heap heap.py, MinHeap.py, MaxHeap.py, MinHeap.java, MaxHeap.java AGAIN
Priority Queue (PQ) Py 1, Py 2, Py 3 AGAIN
Graph
Graph Py, JS. Java1, Java2 OK***
DirectedEdge Java AGAIN

Algorithm

# Title Solution Use case Comment Time complexity Space complexity Status
Binary search Python complexity ref Best : O(1), Avg : O(log N), Worst : O(log N) AGAIN
Linear search Python AGAIN
Breadth-first search (BFS) Python, JS FIND SHORTEST PATH AGAIN***
Depth-first search (DFS) Python, JS TO CHECK IF SOMETHING EXIST inorder, postorder, postorder (can recreate a tree) AGAIN***
Bubble sort Python, JS , C OK* (3)
Insertion sort Python, JS stable sort work very fast for nearly sorted array Best :O(n), Average : O(n^2), Worst : O(n^2) Worst : O(1) AGAIN
Bucket sort Python AGAIN
Quick sort quick_sort.py, quick_sort_v2.py, QuickSort.java NOTE !!!, avg is NLogN, worst is N**2, big O ref, big O ref 2 Best : O(N Log N), Avg : O(N Log N), Worst : O(N^2) AGAIN***
Heap sort Python big O ref Best : O(N Log N), Avg : O(N Log N), Worst : O(N Log N) AGAIN**
Merge sort merge_sort_topdown.py, mergesort_bottomup.py, MergeSortTopDown.java, SQL Best : O(N Log N), Avg : O(N Log N), Worst : O(N Log N) O(N) OK* (2)
Pancake sort Python AGAIN
Selection sort Python, JS AGAIN
Topological sort Python, Java, Java V2 Topological Sort is a algorithm can find "ordering" on an "order dependency" graph AGAIN
md5 Python AGAIN
Union Find Python 1, Python 2, Java 1 AGAIN
Dynamic programming JS 1, fibonacci_dp JS AGAIN
Dijkstra Python,Java AGAIN***
Floyd-Warshall Python not start
Bellman-Ford Python not start
Quick Find Python, Java init : O(N), union : O(N), find : O(1) simple, but slow AGAIN
Quick Union Java, Java v2 init : O(N), union : O(N), find : O(N) lazy approach, route compression, optimized Quick Find AGAIN
Quick Union (Improvements) lazy approach, path compression AGAIN
Priority Queue (unsorted) Java AGAIN
LRU cache Python LC 146 AGAIN
LFU Cache Python LC 460 AGAIN

Array

# Title Solution Time Space Difficulty Note Status
015 3 Sum Python, Java O(n^2) O(1) Medium Curated Top 75, good basic, check with # 001 Two Sum, #018 4 sum, Two Pointers, good basic,amazon,fb OK******* (7)
016 3 Sum Closest Python O(n^2) O(1) Medium Two Pointers, basic, good trick,3 sum,google, fb, apple, m$, GS, amazon AGAIN**** (2)
018 4 Sum Python O(n^3) O(1) Medium k sum, Two Pointers, check #016 3 sum, # 454 4 SUM II,good trick, fb AGAIN******** (4)
026 Remove Duplicates from Sorted Array Python, Scala, Java O(n) O(1) Easy MUST, Two Pointers, basic, good trick,M$ ,fb AGAIN************** (11)
027 Remove Element Python, Java O(n) O(1) Easy MUST, 2 pointers, amazon OK* (2)
031 Next Permutation Python, Scala, Java O(n) O(1) Medium good trick, check, 2 pointers, Uber, GS, google,amazon, fb AGAIN****************** (8) (MUST)
041 First Missing Positive Python O(n) O(1) Hard good trick, hash key , array, LC top 100 like, amazon, fb, google, apple, uber AGAIN******** (2)
048 Rotate Image Python, Java O(n^2) O(1) Medium Curated Top 75, basic, i,j->j,i transpose matrix, garena, amazon, apple AGAIN************* (5) (MUST)
054 Spiral Matrix Python, Java O(m * n) O(1) Medium Curated Top 75, good basic, array boundary, matrix,amazon AGAIN**** (4)
057 Insert Interval Python, Java Medium Curated Top 75, good basic, 056 Merge Intervals, java array, list basic AGAIN********** (5) (MUST!)
059 Spiral Matrix II Python O(n^2) O(1) Medium check # 054 Spiral Matrix, amazon AGAIN** (2)
066 Plus One Python, Java O(n) O(1) Easy basic, digit, google AGAIN** (3)
073 Set Matrix Zeroes Python, Java O(m * n) O(1) Medium Curated Top 75, matrix, amazon OK* (4)
080 Remove Duplicates from Sorted Array II Python, Java O(n) O(1) Medium two pointers,AGAIN, basic, trick, fb, #26 Remove Duplicates from Sorted Array AGAIN************ (8)
118 Pascal's Triangle Python O(n^2) O(1) Easy trick, basic AGAIN** (2)
119 Pascal's Triangle II Python O(n^2) O(1) Easy array, check with # 118 Pascal's Triangle, amazon OK** (4)
121 Best Time to Buy and Sell Stock Python, Java O(n) O(1) Easy Curated Top 75, dp,basic,greedy,UBER, M$, amazon, fb OK****** (7) (but again)
157 Read N Characters Given Read4 Python O(n) O(1) Easy 🔒, buffer, google, amazon, fb AGAIN**** (3)
163 Missing Ranges Python, Java O(n) O(1) Medium two pointer, 🔒, google, amazon OK******* (4)
169 Majority Element Python, Java O(n) O(1) Easy amazon OK*
189 Rotate Array Python O(n) O(1) Medium array, k % len(nums), good basic, amazon OK* (7) (but again)
209 Minimum Size Subarray Sum Python O(n) O(1) Medium good basic, sliding window, Binary Search, trick,2 pointers, fb OK********** (5) (but again)
215 Kth Largest Element in an Array Python, Java O(n) ~ O(n^2) O(1) Medium EPI, quick sort, bubble sort, sort, amazon,fb OK* (2)
228 Summary Ranges Python, Java O(n) O(1) Easy check # 163 Missing Ranges, basic, array, google OK*** (4)
229 Majority Element II Python O(n) O(1) Medium OK
238 Product of Array Except Self Python, Java O(n) O(1) Medium Curated Top 75, left, right array, LintCode, good trick, Apple, M$, amazon, fb OK******* (but again)(6)
240 Search a 2D Matrix II Python O(m + n) O(1) Medium LintCode, basic, matrix, trick, binary search, check # 74 Search a 2D Matrix, amazon, apple OK***** (7) (but again)
243 Shortest Word Distance Python, Java O(n) O(1) Easy 🔒, basic OK*
245 Shortest Word Distance III Python O(n) O(1) Medium 🔒, check Shortest Word Distance I II III OK*
251 Flatten 2D Vector Python O(1) O(1) Medium 🔒, good basic, check# 341 Flatten Nested List Iterator, google, airbnb, twitter, amazon AGAIN******** (4)
277 Find the Celebrity Python O(n) O(1) Medium graph, 🔒, fb,amazon, trick AGAIN********** (5)
287 Find the Duplicate Number Python Medium good trick,binary search, cycle linked list, check # 142 Linked List Cycle II, amazon OK* (2)
289 Game of Life Python O(m * n) O(1) Medium simultaneous,matrix,complex, google, amazon AGAIN*** (4)
293 Flip Game Python O(n * (c+1)) O(1) Easy 🔒, basic AGAIN*
308 Range Sum Query 2D - Mutable Python O(n * (c+1)) O(1) Hard LC 303, pre-sum, matrix, tree, 🔒, google not start
311 Sparse Matrix Multiplication Python O(m * n * l) O(m * l) Medium 🔒, matrix, basic, fb OK**** (4)
334 Increasing Triplet Subsequence Python, Java O(n) O(1) Medium AGAIN, check # 300 Longest Increasing Subsequence, trick, fb, google OK***** (but again) (4)
370 Range Addition Python O(k + n) O(1) Medium prefix sum, array, 🔒, check # 598 Range Addition II, amazon AGAIN************** (4) (MUST)
384 Shuffle an Array Python O(n) O(n) Medium EPI, trick OK*
396 Rotate Function Python O(n) O(1) Medium can pass, math, trick, amazon AGAIN*** (3)
412 Fizz Buzz Python, Scala O(n) O(1) Easy OK
414 Third Maximum Number Python O(n) O(1) Easy good basic, amazon OK* (4)
419 Battleships in a Board Python O(m * n) O(1) Medium AGAIN*
422 Valid Word Square Python O(m * n) O(1) Easy 🔒, basic, matrix AGAIN*
442 Find All Duplicates in an Array Python O(n) O(1) Medium OK*
448 Find All Numbers Disappeared in an Array Python O(n) O(1) Easy OK
498 Diagonal Traverse Python O(n) O(1) Medium matrix,google,fb AGAIN*** (3) (not start)
531 Lonely Pixel I Python O(m * n) O(m + n) Medium 🔒, matrix, basic AGAIN*
533 Lonely Pixel II Python O(m * n) O(m * n) Medium 🔒 AGAIN (not start*)
565 Array Nesting Python O(n) O(1) Medium union find,dfs,apple AGAIN**** (1)
566 Reshape the Matrix Python O(m * n) O(m * n) Easy basic, matrix AGAIN**
581 Shortest Unsorted Continuous Subarray Python O(n) O(1) Easy basic AGAIN*
605 Can Place Flowers Python O(n) O(1) Easy pass vs continue OK*
624 Maximum Distance in Arrays Python O(n) O(1) Easy 🔒 AGAIN*
643 Maximum Average Subarray I Python O(n) O(1) Easy Math, basic AGAIN*
661 Image Smoother Python O(m * n) O(1) Easy matrix,basic, amazon OK***** (4) (but again!)
665 Non-decreasing Array Python O(n) O(1) Easy AGAIN (not start)
667 Beautiful Arrangement II Python O(n) O(1) Medium AGAIN (not start)
670 Maximum Swap Python O(logn) O(logn) Medium good basic, reversed, str -> list,string + pointers , fb AGAIN************ (9) (MUST)
674 Longest Continuous Increasing Subsequence Python, Java O(n) O(1) Easy good basic,dp,2 pointers ,array ,fb OK*** (5)
697 Degree of an Array Python O(n) O(n) Easy AGAIN (not start)
713 Subarray Product Less Than K Python O(n) O(1) Medium basic, sliding window, good trick OK****** (3) (but again)
717 1-bit and 2-bit Characters Python O(n) O(1) Easy Greedy AGAIN (not start)
723 Candy Crush Python O((R * C)^2) O(1) Medium complex AGAIN (not start)
724 Find Pivot Index Python O(n) O(1) Easy OK*
729 My Calendar I Python, Java O(nlogn) O(n) Medium good basic, brute force, binary search, google AGAIN**** (1)
731 My Calendar II Python O(n^2) O(n) Medium trick, basic AGAIN** (not start)
747 Largest Number At Least Twice of Others Python O(n) O(1) Easy good basic, data structure OK*
755 Pour Water Python O(v * n) O(1) Medium complex AGAIN (not start)
766 Toeplitz Matrix Python O(m * n) O(1) Easy basic, matrix, google AGAIN* (2)
769 Max Chunks To Make Sorted Python O(n) O(1) Medium AGAIN** (not start)
792 Number of Matching Subsequences Python, Java O(n + w) O(1) Medium basic, hash map, google AGAIN**** (2)
794 Valid Tic-Tac-Toe State Python O(1) O(1) Medium complex AGAIN
795 Number of Subarrays with Bounded Maximum Python O(n) O(1) Medium AGAIN (not start*)
807 Max Increase to Keep City Skyline Python O(n^2) O(n) Medium AGAIN*
821 Shortest Distance to a Character Python O(n) O(1) Easy basic, trick AGAIN**
830 Positions of Large Groups Python O(n) O(1) Easy basic AGAIN*
832 Flipping an Image Python O(n^2) O(1) Easy AGAIN*
835 Image Overlap Python O(n^4) O(n^2) Medium AGAIN (not start)
840 Magic Squares In Grid Python O(m * n) O(1) Easy complex AGAIN (not start)
842 Split Array into Fibonacci Sequence Python O(n^3) O(n) Medium check # 306 Addictive Number, basic, dfs, fibonacci AGAIN* (not start)
845 Longest Mountain in Array Python O(n) O(1) Medium basic, trick AGAIN* (not start)
849 Maximize Distance to Closest Person Python O(n) O(1) Easy basic, trick AGAIN (not start*)
860 Lemonade Change Python O(n) O(1) Easy amazon OK* (2)
0868 Transpose Matrix Python O(r * c) O(1) Easy basic OK*
885 Spiral Matrix III Python O(max(m, n)^2) O(1) Medium basic AGAIN* (not start)
888 Fair Candy Swap Python O(m + n) O(m + n) Easy basic, trick OK*
896 Monotonic Array Python O(n) O(1) Easy all,array ,fb OK
905 Sort Array By Parity Python O(n) O(1) Easy sort by lambda OK
909 Snakes and Ladders Python O(n^2) O(n^2) Medium array, matrix, dfs,complex, amazon AGAIN***** (3)
915 Partition Array into Disjoint Intervals Python O(n) O(n) Medium basic, trick AGAIN* (not start)
918 Maximum Sum Circular Subarray Python O(n) O(1) Medium check # 053 Maximum Subarray, basic, trick AGAIN* (not start)
921 Minimum Add to Make Parentheses Valid Python O(n) O(1) Medium basic, trick AGAIN**
922 Sort Array By Parity II Python O(n) O(1) Easy basic AGAIN*
923 3Sum With Multiplicity Python O(n^2) O(n) Medium AGAIN (not start)
932 Beautiful Array Python, Java O(n) O(n) Medium basic, trick, google AGAIN** (not start) (1)
941 Valid Mountain Array Python O(n) O(1) Easy basic, good basic AGAIN*
945 Minimum Increment to Make Array Unique Python O(nlogn) O(n) Medium trick, good AGAIN**
947 Most Stones Removed with Same Row or Column Python, Java O(n) O(n) Medium Union Find , dfs, trick,google AGAIN** (1) (not start)
949 Largest Time for Given Digits Python O(1) O(1) Easy OK*
950 Reveal Cards In Increasing Order Python, Java O(n) O(n) Medium queue, 2 pointers, google AGAIN (not start) (2)
954 Array of Doubled Pairs Python O(n + klogk) O(k) Medium counter, dict, trick AGAIN**
961 N-Repeated Element in Size 2N Array Python O(n) O(1) Easy OK
989 Add to Array-Form of Integer Python O(n) O(1) Easy add xxx to sum, fb AGAIN (not start)
004 Median of Two Sorted Arrays Python O(n) O(1) Hard array, heapq, binary search, amazon AGAIN* (1)
010 Regular Expression Matching Python O(n) O(1) Hard recursion, dp, fb AGAIN (not start)
056 Merge Intervals Python, Java O(n) O(1) Medium Curated Top 75, good trick,057 Insert Interval, twitter,M$,UBER,google,amazon,fb OK********* (6) (but AGAIN)
759 Employee Free Time Python O(n) O(1) Hard LC 56 and LC 986, heap, merger intervals, scanning line, amazon, fb, google, uber, airbnb AGAIN********** (2) (not start)
1007 Minimum Domino Rotations For Equal Row Java O(n) O(1) Medium google, array, dp AGAIN (1)
1014 Best Sightseeing Pair Python Medium dp, array, good basic, Spotify AGAIN (not start)
1027 Longest Arithmetic Subsequence Python Medium dp, hash table, trick, google, amazon AGAIN*** (not start)
1041 Robot Bounded In Circle Python Medium array, math, amazon AGAIN** (2)
1109 Corporate Flight Bookings Python Medium array, amazon AGAIN (not start)
1248 Count Number of Nice Subarrays Python Medium LC 828, hash map, Prefix sum, dict, windown, good basic, deque, array, amazon AGAIN************** (3) (MUST)
1275 Find Winner on a Tic Tac Toe Game Python Easy amazon AGAIN (not start)
1567 Maximum Length of Subarray With Positive Product Python Medium good trick, array, dp, 2 pointers, amazon AGAIN**** (1) (not start)
1914 Cyclically Rotating a Grid Python Medium array, brute force, dequeueamazon AGAIN (not start)
3195 Find the Minimum Area to Cover All Ones I Java Medium array, LC weekly AGAIN (1)

Set

# Title Solution Time Space Difficulty Note Status
2357 Make Array Zero by Subtracting Equal Amounts Java O(n^2) O(1) Medium set Again (1)

Hash Table

# Title Solution Time Space Difficulty Status Note
001 Two Sum Python, Java,Scala O(n) O(n) Easy good basic, hash table, apple, amazon, UBER, grab, fb OK*** (6) (but again)
003 Longest Substring Without Repeating Characters Python, Java O(n) O(1) Medium Curated Top 75, 2 pointers, optimized (SLIDING WINDOW + DICT),good trick, hashMap, MUST, apple,amazon,fb AGAIN**************** (11) (but AGAIN)
036 Valid Sudoku Python, Java O(9^2) O(9) Medium array, hashset, UBER, apple, amazon OK**** (3) (again)
049 Group Anagrams Python, Scala, Java O(n * glogg) O(n) Medium Curated Top 75, good basic, dict,trick,dict + sort, UBER, amazon, fb OK ********** (6)
170 Two Sum III - Data structure design Python O(n) O(n) Easy 🔒, trick,good basic, linkedin, fb OK*** (4)
187 Repeated DNA Sequences Python O(n) O(n) Medium basic,trick,set, linkedin AGAIN**
202 Happy Number Python , Java O(k) O(k) Easy twitter,airbnb, UBER AGAIN** (4)
204 Count Primes Python O(n) O(n) Medium good trick, cache, dict, set, M$, amazon AGAIN******** (5)
205 Isomorphic Strings Python, Java O(n) O(1) Easy basic, trick, bloomberg AGAIN**
217 Contains Duplicate Python , Java O(n) O(n) Easy Curated Top 75, yahoo, airbnb OK
219 Contains Duplicate II Python O(n) O(n) Easy basic, trick, hash table AGAIN*
244 Shortest Word Distance II Python ctor: O(n), lookup: O(a + b) O(n) Medium 🔒 AGAIN (not start*)
246 Strobogrammatic Number Python, Java O(n) O(1) Easy 🔒, google, fb OK* (5)
249 Group Shifted Strings Python , Java O(nlogn) O(n) Medium LC 49, 🔒, apple, UBER, google AGAIN****(5)
266 Palindrome Permutation Python O(n) O(1) Easy 🔒 OK
288 Unique Word Abbreviation Python ctor: O(n), lookup: O(1) O(k) Medium 🔒, ?, google AGAIN (2)(not start)
290 Word Pattern Python O(n) O(c) Easy basic, chcek # 205 Isomorphic Strings,good basic, for ptn, word in zip(pattern, words), dropbox , UBER AGAIN* (3)
299 Bulls and Cows Python O(n) O(1) Easy trick,map(operator.eq, a, b),amazon, airbnb, google AGAIN* (3)
314 Binary Tree Vertical Order Traversal Python O(n) O(n) Medium 🔒, BFS,DFS,hash table, tree, trick,google, amazon,fb, m$ OK**** (6)
325 Maximum Size Subarray Sum Equals k Python, Java O(n) O(n) Medium prefix sum, 🔒, basic, good trick, dict, fb AGAIN************** (8) (MUST)
356 Line Reflection Python O(n) O(n) Medium 🔒, Hash, Two Pointers,math,google AGAIN (not start)
359 Logger Rate Limiter Python, Java O(1), amortized O(k) Easy 🔒, google OK
387 First Unique Character in a String Python O(n) O(n) Easy amazon, apple, fb OK
388 Longest Absolute File Path Python O(n) O(d) Medium stack, hash table, good trick, file system, google AGAIN******* (3)
409 Longest Palindrome Python O(n) O(1) Easy OK*
424 Longest Repeating Character Replacement Python, Java O(n) O(1) Medium Curated Top 75, silding window, two pointers, good trick, LC blind pattern AGAIN************* (8) (MUST)
438 Find All Anagrams in a String Python O(n) O(1) Medium trick, AGAIN, sliding window,acc Counter,amazon,fb, apple, google, uber, yahoo AGAIN************** (8)
447 Number of Boomerangs Python O(n^2) O(n) Easy trick, google AGAIN (3) (not start)
454 4Sum II Python O(n^2) O(n^2) Medium check LC 018 4SUM, trick, basic, amazon AGAIN**
463 Island Perimeter Python O(n) O(k) Medium basic,hash table, google, fb, amazon AGAIN** (2)
470 Implement Rand10() Using Rand7() Python O(1) O(1) Medium trick, google AGAIN** (3)
473 Matchsticks to Square Python O(n * s * 2^n) O(n * (2^n + s)) Medium complex,hard AGAIN (not start)
523 Continuous Subarray Sum Python O(n) O(k) Medium sub array sum, check # 560 Subarray Sum Equals K,good trick,substring, hash table,AGAIN,M$,fb, apple AGAIN*************** (10) (MUST)
525 Contiguous Array Python O(n) O(n) Medium sub-array sum, good basic, array, hashmap, cache, AGAIN, fb, amazon AGAIN*************** (11) (MUST)
532 K-diff Pairs in an Array Python O(n) O(n) Medium hash table, basic, collections.Counter(),a-b =k -> a = k + b , amazon AGAIN********** (6)
554 Brick Wall Python O(n) O(m) Medium trick,hash map, bloomberg, fb, grab AGAIN******** (5)
560 Subarray Sum Equals K Python O(n) O(n) Medium must check,check # 523 Continuous Subarray Sum, LC 1268,basic, substring,good trick,google,fb AGAIN************** (6) (MUST)
561 Array Partition I Python O(r) O(r) Easy OK
575 Distribute Candies Python O(n) O(n) Easy OK
594 Longest Harmonious Subsequence Python O(n) O(n) Easy basic, good trick OK* (3)
599 Minimum Index Sum of Two Lists Python O((m + n) * l) O(m * l) Easy yelp OK*
609 Find Duplicate File in System Python O(n * l) O(n * l) Medium collections.defaultdict(list), dropbox OK*
657 Robot Return to Origin Python Easy amazon OK (2)
748 Shortest Completing Word Python O(n) O(1) Easy collections.Counter, hash table,google AGAIN* (3)
760 Find Anagram Mappings Python O(n) O(n) Easy basic, collections.defaultdict OK
771 Jewels and Stones Python O(m + n) O(n) Easy amazon OK (2)
811 Subdomain Visit Count Python O(n) O(n) Easy indeed, bloomberg AGAIN (not start)
822 Card Flipping Game Python O(n) O(n) Medium good basic AGAIN* (3)
825 Friends Of Appropriate Ages Python O(a^2 + n) O(a) Medium good basic,counter,AGAIN,fb AGAIN***** (5)
869 Reordered Power of 2 Python O(1) O(1) Medium trick,basic, bit manipulation, bit AGAIN*
873 Length of Longest Fibonacci Subsequence Python O(n^2) O(n) Medium trick, DP, Fibonacci, set AGAIN**
957 Prison Cells After N Days Python O(1) O(1) Medium trick, DP, mod AGAIN (not start)
966 Vowel Spellchecker Python O(n) O(w) Medium trick, dict, set AGAIN (not start)
974 Subarray Sums Divisible by K Python O(n) O(k) Medium variant of # 560 Subarray Sum Equals K , trick, basic AGAIN** (3) (not start)
992 Subarrays with K Different Integers Python O(n) O(k) Hard 2 pointers, hashmap, sliding window, amazon AGAIN (not start)
1010 Pairs of Songs With Total Durations Divisible by 60 Python Medium good basicm dict, array, amazon AGAIN********* (4) (MUST)
1099 Two Sum Less Than K Python Medium dict, sort, amazon AGAIN* (1) (not start)
1131 Rank Transform of an Array Python Easy dict, array, amazon OK* (1)
1170 Compare Strings by Frequency of the Smallest Character Java Medium hashmap, binary search, google AGAIN*** (1)
1296 Divide Array in Sets of K Consecutive Numbers Python Medium LC 846, dict, google AGAIN (not start)
1923 Longest Common Subpath Python O(n) O(h) Hard hash, bit, amazon AGAIN (not start)

Linked list

# Title Solution Time Space Difficulty Note Status
002 Add Two Numbers Python, Java O(n) O(1) Medium Curated Top 75, check # 445 Add Two Numbers II, basic, linked list, airbnb, amazon, fb OK**** (6) (but again)
021 Merge Two Sorted Lists Python, Java O(n) O(1) Easy Curated Top 75, UBER, amazon, apple, fb OK******** (6) (but again)
023 Merge k sorted lists Python, Java O(n) O(h) Hard Curated Top 75, linked list, check #21 Merge Two Sorted Lists, amazon OK**** (2) (but again !!!
024 Swap Nodes in Pairs Python, Java O(n) O(1) Medium GOOD basic, LC 100 like, UBER,amazon, fb AGAIN**************** (7) (MUST)
025 Reverse Nodes in k-Group Python, Java O(n) O(1) Hard good trick, reverse linkedlist, reverse K linkedlist, amazon, google, fb, m$ AGAIN********** (4)
061 Rotate List Python O(n) O(1) Medium basic AGAIN (2)
082 Remove Duplicates from Sorted List II Python O(n) O(1) Medium check # 083 Remove Duplicates from Sorted List AGAIN (2)
083 Remove Duplicates from Sorted List Python, Java O(n) O(1) Easy basic OK*
092 Reverse Linked List II Python O(n) O(1) Medium # 206 Reverse Linked List, good trick, fb, apple, google, amazon, m$ AGAIN*********** (5 (MUST)
138 Copy List with Random Pointer Python, Java O(n) O(1) Medium trick, recursive, linked list,hash table, UBER, M$, amazon, fb AGAIN******* (7)
160 Intersection of Two Linked Lists Python, Java O(m + n) O(1) Easy basic, hash table, 2 pointers, linkedlist, airbnb, amazon,fb OK******* (7) (again!)
203 Remove Linked List Elements Python , Java O(n) O(1) Easy linked list basic,amazon OK** (3)
206 Reverse Linked List Python, Java O(n) O(1) Easy Curated Top 75, good basic,amazon,fb OK*********** (9) (MUST again)
234 Palindrome Linked List Python, Java O(n) O(1) Easy linked list,amazon,fb OK (4)
237 Delete Node in a Linked List Python O(1) O(1) Easy LintCode, apple OK * (1) (but again)
328 Odd Even Linked List Python O(n) O(1) Medium basic OK** (2)
369 Plus One Linked List Python O(n) O(1) Medium 🔒, basic, trick AGAIN* (2)
445 Add Two Numbers II Python O(m + n) O(m + n) Medium trick, linked list, string,good basic, amazon AGAIN*** (3)
725 Split Linked List in Parts Python O(n + k) O(1) Medium mod, split linked list, linked list, good trick,amazon AGAIN************ (6) (again)
817 Linked List Components Python O(m + n) O(m) Medium OK*
430 Flatten a Multilevel Doubly Linked List Python, Java Medium good trick,doubly linked list,AGAIN,dfs, fb, google AGAIN********* (4)
707 Design Linked List Python, Java O(n) O(h) Medium linked list basic OP AGAIN (1)
708 Insert into a Cyclic Sorted List Python O(n) O(h) Medium AGAIN,cyclic linked list,good trick, google, amazon, fb AGAIN******** (4)

Stack

# Title Solution Time Space Difficulty Note Status
020 Valid Parentheses Python, Java O(n) O(n) Easy Curated Top 75, good basic,fb, amazon OK** (6)
032 Longest Valid Parentheses Python O(n) O(n) Hard brute force, dp, stackm deque, LC top 100 likes, amazon, fb, m$ AGAIN***** (1) (not start)
071 Simplify Path Python O(n) O(n) Medium basic, stack, amazon,fb OK** (5)
085 Maximal Rectangle Python O(n) O(n) Hard top-100-like, brute force, stack, dp, LC 084, google, amazon, apple AGAIN (not start)
101 Symmetric Tree Python, Java O(n) O(h) Easy good basic,bfs, dfs, linkedin, M$,amazon, fb, google AGAIN********** (5)
150 Evaluate Reverse Polish Notation Python, Java O(n) O(n) Medium stack, good trick,amazon AGAIN********* (5)
155 Min Stack Python, Java O(n) O(1) Medium basic, stack, data structure, amazon OK******* (5)
173 Binary Search Tree Iterator Python O(1) O(h) Medium good basic,tree, stack, M$, linkedin, google,amazon,fb OK***** (5)
224 Basic Calculator Python O(n) O(n) Hard basic,trick,stack, LC 227, amazon AGAIN******* (3)
227 Basic Calculator II Python O(n) O(n) Medium delay op, LC 224, good trick,stack,airbnb ,fb, amazon AGAIN************** (6) (MUST)
232 Implement Queue using Stacks Python O(1), amortized O(n) Easy stack, stack-queue, EPI, LintCode, amazon OK** (2)
255 Verify Preorder Sequence in Binary Search Tree Python O(n) O(1) Medium 🔒 AGAIN (not start)
331 Verify Preorder Serialization of a Binary Tree Python O(n) O(1) Medium AGAIN (not start)
341 Flatten Nested List Iterator Python O(n) O(h) Medium LC 284, 🔒 Iterator, stack, generator, good basic,amazon,fb*** AGAIN********* (6)
385 Mini Parser Python O(n) O(h) Medium AGAIN
394 Decode String Python, Java O(n) O(h) Medium stack, good basic!!!!, pre num string, LC 224, LC 227, amazon, google AGAIN************** (7) (MUST)
439 Ternary Expression Parser Python O(n) O(1) Medium 🔒 AGAIN (not start)
456 132 Pattern Python O(n) O(n) Medium AGAIN (not start)
496 Next Greater Element I Python, Java O(n) O(n) Easy good basic, stack,monotonic stack, LC 739, LC 503, LC 406 OK********* (5) (but again)
503 Next Greater Element II Python O(n) O(n) Medium good basic, stack, LC 739, LC 503, LC 406 AGAIN************* (7)
636 Exclusive Time of Functions Python O(n) O(n) Medium trick,AGAIN,stack,UBER, fb AGAIN********** (4)
682 Baseball Game Python, Java O(n) O(n) Easy good basic, stack,amazon OK* (3)
735 Asteroid Collision Python O(n) O(n) Medium good basic, stack, m$, GS, fb, amazon AGAIN************** (5)
739 Daily Temperatures Python, Java O(n) O(n) Medium LC 739, LC 503, LC 406, LC 496, LC 42, Monotonic stack, good trick,amazon AGAIN******************* (12) (MUST)
772 Basic Calculator III Python O(n) O(n) Medium check LC 224, 227 AGAIN (not start)
853 Car Fleet Python, Java O(nlogn) O(n) Medium array, stack, good trick, google, amz AGAIN***** (2)
856 Score of Parentheses Python O(n) O(1) Medium AGAIN (not start)
872 Leaf-Similar Trees Python, Java O(n) O(h) Easy AGAIN*
895 Maximum Frequency Stack Python O(n) O(h) Hard good basic, heap, design, stack, amazon, apple, linkedin, m$, twitter AGAIN********** (1) (not start)
901 Online Stock Span Python O(n) O(n) Medium AGAIN (not start)
946 Validate Stack Sequences Python O(n) O(n) Medium AGAIN
1047 Remove All Adjacent Duplicates in String Python, Java O(n) O(n) easy good basic, fb, amazon, google AGAIN************ (3) (MUST)
1209 Remove All Adjacent Duplicates in String II Python O(n) O(n) Medium good basic, stack, two pointers, greedy, fb, amamzon, apple, spotify AGAIN************ (3) (MUST)
1703 Minimum Adjacent Swaps for K Consecutive Ones Python O(n) O(n) Hard heap, sliding window, amazon AGAIN (not start)
1896 Minimum Cost to Change the Final Value of Expression Python O(n) O(n) Hard complex, stack, dp, dp+stack, dfs, amazon AGAIN (not start)

Tree

# Title Solution Time Space Difficulty Note Status
094 Binary Tree Inorder Traversal Python O(n) O(1) Medium tree, iteration, recursion, good basic,Morris Traversal, M$, fb AGAIN********* (4) (MUST)
124 Binary Tree Maximum Path Sum Python, Java O(n) O(1) Hard Curated Top 75, google, amazon, fb, m$, twitter AGAIN******* (2)
144 Binary Tree Preorder Traversal Python O(n) O(1) Medium Morris Traversal AGAIN
208 Implement Trie (Prefix Tree) Python, Java O(n) O(1) Medium Curated Top 75, dict tree, LC 211, trie, amazon,fb AGAIN************** (7) (MUST)
211 Design Add and Search Words Data Structure Python, Java O(min(n, h)) O(min(n, h)) Medium Curated Top 75, Trie, recursive, node, hashMap, do # 208 first,amazon ,fb AGAIN*********** (8) (MUST)
226 Invert Binary Tree Python, Java O(n) O(h), O(w) Easy Curated Top 75, good basic OK******* (4) (but again)
297 Serialize and Deserialize Binary Tree Python, Java O(n) O(h), O(w) Hard Curated Top 75, binary treee again
307 Range Sum Query - Mutable Python ctor: O(n), update: O(logn), query: O(logn) O(n) Medium LintCode, DFS, Segment Tree, BIT, check #303 Range Sum Query - Immutable AGAIN* (2)(not start)
536 Construct Binary Tree from String Python, Java O(n) O(h) Medium 🔒, tree, recursive, trick, check # 606 Construct String from Binary Tree, amazon AGAIN******** (5)
538 Convert BST to Greater Tree Python, Java O(n) O(h) Medium good basic, dfs, bfs, tree, amazon OK********* (6) (but again!)
543 Diameter of Binary Tree Python, Java O(n) O(h) Easy dfs, tree, trick,google,amazon,fb AGAIN********* (4)
545 Boundary of Binary Tree Python O(n) O(h) Medium recursive, dfs, tree boundary, tree,🔒, good trick, amazon AGAIN********* (6)
548 Split Array with Equal Sum Python O(n^2) O(n) Medium 🔒, good trick, array AGAIN*** (2)
563 Binary Tree Tilt Python O(n) O(n) Easy AGAIN
572 Subtree of Another Tree Python, Java O(m * n) O(h) Easy Curated Top 75, LC 100, recursive call recursion func, good basic, dfs, bfs, amazon,fb OK************* (10) (but again)
606 Construct String from Binary Tree Python O(n) O(h) Easy good basic, tree, dfs, LC # 536, amazon OK******** (7) (again!)
617 Merge Two Binary Trees Python, Java O(n) O(h) Easy tree, dfs, bfs, good basic, amazon OK************* (7) (but again)
623 Add One Row to Tree Python O(n) O(h) Medium good basic, dfs, bfs AGAIN** (2)
637 Average of Levels in Binary Tree Python, Java O(n) O(h) Easy bfs, dfs, good basic, fb OK*** (4)
652 Find Duplicate Subtrees Python O(n) O(n) Medium AGAIN, good basic,dfs, Hash, amazon AGAIN************** (6)
653 Two Sum IV - Input is a BST Python, Java O(n) O(h) Easy Two Pointers,2 sum,bfs, dfs,amazon,fb OK******* (4)
654 Maximum Binary Tree Python, Java O(n) O(n) Medium LintCode, Descending Stack, good basic AGAIN* (2)
655 Print Binary Tree Python O(n) O(h) Medium AGAIN* (2) (not start)
662 Maximum Width of Binary Tree Python O(n) O(h) Medium width of tree, bfs, dfs, trick, amazon AGAIN********* (5)
663 Equal Tree Partition Python O(n) O(n) Medium # LC 508, AGAIN, 🔒 , Hash, tree, dfs ,trick, good trick, amazon OK******** (8)
677 Map Sum Pairs Python O(n) O(t) Medium Trie, trick, hard AGAIN* (2) (not start)
684 Redundant Connection Python, Java O(n) O(n) Medium dfs, graph, Union Find, basic AGAIN****** (3) (not start)
687 Longest Univalue Path Python, Java O(n) O(h) Medium basic, dfs, tree, trick, google AGAIN**** (4)
814 Binary Tree Pruning Python O(n) O(h) Medium DFS, basic AGAIN* (2)
863 All Nodes Distance K in Binary Tree Python O(n) O(n) Medium LC 752, tree, DFS + BFS, trick, hard, amazon AGAIN************ (4)
866 Smallest Subtree with all the Deepest Nodes Python O(n) O(h) Medium DFS, trick, basic AGAIN** (2)
889 Construct Binary Tree from Preorder and Postorder Traversal Python, Java O(n) O(h) Medium DFS, stack, trick, tree, recursive, google AGAIN** (2) (not start*)
897 Increasing Order Search Tree Python O(n) O(h) Easy DFS, good basic,inorder AGAIN** (2)
919 Complete Binary Tree Inserter Python ctor: O(n)
insert: O(1)
get_root: O(1)
O(n) Medium bst AGAIN** (2)
938 Range Sum of BST Python O(n) O(h) Medium DFS, check # 108 Convert Sorted Array to Binary Search Tree AGAIN* (2)
951 Flip Equivalent Binary Trees Python, Java O(n) O(h) Medium recursion, tree, DFS, google AGAIN***s (3)
958 Check Completeness of a Binary Tree Python O(n) O(w) Medium BFS, DFS, basic AGAIN** (2)
965 Univalued Binary Tree Python O(n) O(h) Easy DFS, BFS, good basic AGAIN** (2)
971 Flip Binary Tree To Match Preorder Traversal Python O(n) O(h) Medium DFS, trick AGAIN** (2) (not start)
979 Distribute Coins in Binary Tree Python O(n) O(h) Medium DFS, trick AGAIN*** (2)
508 Most Frequent Subtree Sum Python Medium tree, dfs, bfs, good basic,amazon OK*********** (4) (but again MUST)
683 K Empty Slots Python Hard BST, tree, bucket, google not start
701 Insert into a Binary Search Tree Python Medium good basic, BST, tree, BFS, DFS OK*** (2)
1032 Stream of Characters Java Hard trie, google AGAIN (not start)
1339 Maximum Product of Splitted Binary Tree Python Medium dfs, tree, amazon AGAIN*** (1) (not start)
1372 Longest ZigZag Path in a Binary Tree Python Medium dfs, bfs, post order, good trick, tree, amazon AGAIN*** (1) (not start)
1448 Count Good Nodes in Binary Tree Python, Java Medium max in path, dfs, bfs, good trick, tree, needcode, google, amz, m$ AGAIN********* (1) (MUST)

Heap

# Title Solution Time Space Difficulty Note Status
264 Ugly Number II Python O(n) O(1) Medium good trick, LC 263, LC 313, Heap, LintCode , DP, M$ AGAIN*********** (4) (MUST)
313 Super Ugly Number Python O(n * k) O(n + k) Medium BST, Heap AGAIN (not start*)
373 Find K Pairs with Smallest Sums Python O(k * log(min(n, m, k))) O(min(n, m, k)) Medium AGAIN (not start)
378 Kth Smallest Element in a Sorted Matrix Python O(k * log(min(n, m, k))) O(min(n, m, k)) Medium LintCode AGAIN (not start)
846 Hand of Straights Python, Java O(nlogn) O(n) Medium LC 1296, good basic, Treemap, hashmap, google OK*** (2)
855 Exam Room Python, Java seat: O(logn)
leave: O(logn)
O(n) Medium treeSet, BST, Hash, trick, google AGAIN* (3) (not start)
295 Find Median from Data Stream Python, Java Hard Curated Top 75, priority queue, trick ,heap, stream, amazon AGAIN****** (6)
703 Kth Largest Element in a Stream Python, Java Easy heap, priority queue, amazon AGAIN***** (4)
1046 Last Stone Weight Python, Java Easy Heap, Priority Queue OK
1130 Minimum Cost Tree From Leaf Values Python Medium LC 1167,heap not start
1167 Minimum Cost to Connect Sticks Python Medium LC 1130, good basic,heap,amazon AGAIN***** (3)
1353 Maximum Number of Events That Can Be Attended Python, Java Medium LC 252, 253, good trick, meeting room, heap, PRIORITY QUEUE, fb, twitter, amazon AGAIN********* (3) MUST
1481 Least Number of Unique Integers after K Removals Python Medium good trick, greedy, Counter, dict, heap,amazon AGAIN******** (3)

Bit Manipulation

# Title Solution Time Space Difficulty Note Status
136 Single Number Python O(n) O(1) Easy airbnb,amazon,fb OK
137 Single Number II Python O(n) O(1) Medium OK
190 Reverse Bits Python, Java O(1) O(1) Easy Curated Top 75, bit, apple AGAIN*** (2)
191 Number of 1 Bits Python, Java O(1) O(1) Easy Curated Top 75, apple OK*
201 Bitwise AND of Numbers Range Python O(1) O(1) Medium AGAIN (not start)
231 Power of Two Python O(1) O(1) Easy good basic, Bit Manipulation ,amazon OK*** (3)
260 Single Number III Python O(n) O(1) Medium xor, ^=, ^ AGAIN*
268 Missing Number Python, Java O(n) O(1) Medium Curated Top 75, xor,amazon,fb OK* (2)
318 Maximum Product of Word Lengths Python O(n) ~ O(n^2) O(n) Medium Bit Manipulation, Counting Sort, Pruning AGAIN (not start)
342 Power of Four Python O(1) O(1) Easy power of num OK*
371 Sum of Two Integers Python, Java O(1) O(1) Medium Curated Top 75, good basic, fb AGAIN********* (5) (bit op not start)
389 Find the Difference Python O(n) O(1) Easy amazon OK (2)
393 UTF-8 Validation Python O(n) O(1) Medium utf-8 encoding, google, fb AGAIN**** (not start*) (5)
401 Binary Watch Python O(1) O(1) Easy OK*
421 Maximum XOR of Two Numbers in an Array Python O(n) O(n) Medium AGAIN (not start)
461 Hamming Distance Python O(1) O(1) Easy fb OK* (2)
462 Minimum Moves to Equal Array Elements II Python O(n) on average O(1) Medium AGAIN*
477 Total Hamming Distance Python O(n) O(1) Medium bit manipulation, fb AGAIN****** (not start*) (4)
645 Set Mismatch Python O(n) O(1) Easy amazon OK* (3)
693 Binary Number with Alternating Bits Python O(1) O(1) Easy trick AGAIN*
762 Prime Number of Set Bits in Binary Representation Python O(1) O(1) Easy basic,Bit_Manipulation, prime number, amazon OK* (4)
868 Binary Gap Python O(1) O(1) Easy trick, linear scan AGAIN*
898 Bitwise ORs of Subarrays Python O(n) O(1) Medium AGAIN (not start)
1573 Number of Ways to Split a String Python O(n) O(1) Medium amazon, binary AGAIN** (not start)
1915 Number of Wonderful Substrings Python O(n) O(1) Medium bit mask, bit, prefix sum, dp, amazon AGAIN*** (2) (not start)

String

# Title Solution Time Space Difficulty Status, Note Status
005 Longest Palindromic Substring Python, Java O(n) O(n) Medium Curated Top 75, LC 647, good trick, 2 pointer, recursive, Manacher's Algorithm, LC 100 like, DP, UBER, amazon, fb AGAIN************** (8)(MUST)
006 ZigZag Conversion Python O(n) O(1) Medium AGAIN (not start)
008 String to Integer (atoi) Python O(n) O(1) Medium string op, regular expression,UBER, amazon, fb AGAIN***** (5)
014 Longest Common Prefix Python O(n * k) O(1) Easy good basic OK*
028 Implement strStr() Python, Java O(n + k) O(k) Easy KMP Algorithm, fb OK (3)
038 Count and Say Python, Java O(n * 2^n) O(2^n) Medium recursion, iteration, basic, fb AGAIN*********** (5)
043 Multiply Strings Python, Java O(m * n) O(m + n) Medium twitter, fb AGAIN*** (3)
058 Length of Last Word Python O(n) O(1) Easy OK
067 Add Binary Python, Java O(n) O(1) Easy bit op, good basic, fb, amazon OK***** (7) (but again)
076 Minimum Window Substring Python, Java Hard Curated Top 75 AGAIN******* (2) (not start)
125 Valid Palindrome Python, Java O(n) O(1) Easy Curated Top 75, LC 680, amazon,fb OK
151 Reverse Words in a String Python O(n) O(1) Medium amazon,fb OK (2)
161 One Edit Distance Python O(m + n) O(1) Medium 🔒, trick, recursion, string, , fb AGAIN ******** (6)(AGAIN)
165 Compare Version Numbers Python O(n) O(1) Medium good basic, string,amazon, apple OK** (5)
186 Reverse Words in a String II Python O(n) O(1) Medium LC 151, LC 557, 🔒, M$,UBER, amazon AGAIN* (3)
242 Valid Anagram Python, Java O(n) O(1) Easy Curated Top 75, LintCode,amazon,fb OK
271 Encode and Decode Strings Python, Java O(n) O(1) Medium Curated Top 75, decode-encode,string op, check # 394 Decode String ,🔒, google AGAIN*** (3)
306 Addictive Number Python O(n^3) O(n) Medium AGAIN (not start*)
340 Longest Substring with At Most K Distinct Characters Python O(n^3) O(n) Hard string, sliding window, google not start
383 Ransom Note Python O(n) O(1) Easy EPI, apple OK*
405 Convert a Number to Hexadecimal Python O(n) O(1) Easy basics decimal -> Hexadecimal AGAIN
408 Valid Word Abbreviation Python O(n) O(1) Easy 🔒 AGAIN (not start)
415 Add Strings Python O(n) O(1) Easy good basic, add xxx to sum, Airbnb, google, fb OK****** (4)
434 Number of Segments in a String Python O(n) O(1) Easy OK
443 String Compression Python O(n) O(1) Easy shoptify, basics AGAIN**
459 Repeated Substring Pattern Python O(n) O(n) Easy good basic, string, KMP Algorithm, amazon OK*** (6)
468 Validate IP Address Python O(1) O(1) Medium ip basic,string,twitter, fb, amazon AGAIN****** (5)
482 License Key Formatting Python, Java O(n) O(1) Easy string, basic, google OK** (4) (again)
520 Detect Capital Python O(l) O(1) Easy OK
521 Longest Uncommon Subsequence I Python O(min(a, b)) O(1) Easy OK*
522 Longest Uncommon Subsequence II Python O(l * n^2) O(1) Medium Sort AGAIN (not start)
524 Longest Word in Dictionary through Deleting Python, Java O((d * l) * logd) O(1) Medium Sort, dict, brute force, google AGAIN (not start)
539 Minimum Time Difference Python O(nlogn) O(n) Medium basic, map & zip trick AGAIN**
541 Reverse String II Python O(n) O(1) Easy AGAIN*
551 Student Attendance Record I Python O(n) O(1) Easy OK
556 Next Greater Element III Python O(1) O(1) Medium AGAIN (not start)
557 Reverse Words in a String III Python O(n) O(1) Easy OK
616 Add Bold Tag in String Python O(n * d * l) O(n) Medium 🔒, google AGAIN (not start)
647 Palindromic Substrings Python, Java O(n) O(n) Medium Curated Top 75, LC 005, greedy, DP, expand from center, 2 pointers, good basic,Manacher's Algorithm, Linkedin,amazon,fb OK********* (8) (MUST)
648 Replace Words Python O(n) O(t) Medium Trie, good basic OK*
657 Judge Route Circle Python O(n) O(1) Easy OK
678 Valid Parenthesis String Python O(n) O(1) Medium AGAIN**
680 Valid Palindrome II Python O(n) O(1) Easy LC 125, two pointers, good basic, Palindrome, string, fb AGAIN******** (3)
681 Next Closest Time Python O(1) O(1) Medium subset of set, <=,strptime, google,fb OK*** (5)
686 Repeated String Match Python, Java O(n + m) O(1) Medium brute force, math, string, Rabin-Karp Algorithm, google AGAIN**** (3)
696 Count Binary Substrings Python O(n) O(1) Easy good trick, linear scan, group sub-string, amazon AGAIN******* (3) (MUST)
720 Longest Word in Dictionary Python O(n) O(t) Easy Trie AGAIN (not start)
722 Remove Comments Python O(n) O(k) Medium AGAIN (not start)
734 Sentence Similarity Python , Java O(n + p) O(p) Easy good basic, graph, hash table,collections.defaultdict(set) ,google OK***** (5)
751 IP to CIDR Python O(n) O(1) Medium ip AGAIN (not start*)
758 Bold Words in String Python O(n * l) O(t) Easy 🔒, variant of Add Bold Tag in String AGAIN (not start)
791 Custom Sort String Python O(n) O(1) Medium good basic, sort, counter, amazon, fb AGAIN************ (7) (MUST)
796 Rotate String Python O(n) O(1) Easy good basic, KMP Algorithm, Rabin-Karp Algorithm,amazon OK**** (2)(but again)
804 Unique Morse Code Words Python O(n) O(n) Easy OK*
806 Number of Lines To Write String Python O(n) O(1) Easy OK*
809 Expressive Words Python, Java O(n + s) O(l + s) Medium google, string AGAIN (1)
816 Ambiguous Coordinates Python O(n^4) O(n) Medium AGAIN (not start*)
819 Most Common Word Python O(m + n) O(m + n) Easy regular expression, amazon OK** (2)
820 Short Encoding of Words Python O(n) O(t) Medium Trie AGAIN (not start)
824 Goat Latin Python O(n + w^2) O(l) Easy string basic, fb OK
828 Count Unique Characters of All Substrings of a Given String Python O(n + w^2) O(l) Hard LC 1248, dp, string, amazon AGAIN*** (2)
831 Masking Personal Information Python O(1) O(1) Medium regular expression OK*
833 Find And Replace in String Python, Java O(n + m) O(n) Medium good basic, string op, hashmap, google AGAIN****** (3)
848 Shifting Letters Python O(n) O(1) Medium remainder, basic AGAIN**
859 Buddy Strings Python O(n) O(1) Easy AGAIN*
880 Decoded String at Index Python O(n) O(1) Medium trick AGAIN (not start**)
884 Uncommon Words from Two Sentences Python O(m + n) O(m + n) Easy collections Counter, trick OK*
890 Find and Replace Pattern Python O(n * l) O(1) Medium AGAIN (not start)
893 Groups of Special-Equivalent Strings Python O(n * l) O(n) Easy AGAIN*
916 Word Subsets Python O(m + n) O(1) Medium AGAIN (not start)
917 Reverse Only Letters Python O(n) O(1) Easy basic,stack,pointer OK*
925 Long Pressed Name Python O(n) O(1) Easy two pointer, basic, trick AGAIN*
929 Unique Email Addresses Python O(n * l) O(n * l) Easy OK
939 Minimum Area Rectangle Python, Java O(n^1.5) on average O(n) Medium hashmap, brute force, google AGAIN !!! (2)
942 DI String Match Python O(n) O(1) Easy AGAIN (not start)
944 Delete Columns to Make Sorted Python O(n * l) O(1) Medium AGAIN (not start)
953 Verifying an Alien Dictionary Python O(n * l) O(1) Easy AGAIN (not start)
955 Delete Columns to Make Sorted II Python O(n * l) O(n) Medium AGAIN (not start)
1119 Remove Vowels from a String Python O(n * l) O(n) Easy amazon OK

Queue

# Title Solution Time Space Difficulty Tag Note
281 Zigzag Iterator Python O(n) O(k) Medium good basic, queue, 🔒, google,fb AGAIN******* (5)
346 Moving Average from Data Stream Python, Java O(1) O(w) Easy 🔒, queue, google, fb OK** (6)
933 Number of Recent Calls Python O(1) on average O(w) Easy AGAIN**
622 Design Circular Queue Python Medium good basic, array, linked list, design, circular queue,amazon,fb, apple, airbnb, m$ AGAIN************ (3) (MUST)
239 Sliding Window Maximum Python Hard sliding window, heap, deque, queue,amazon, google AGAIN********* (4)

Math

# Title Solution Time Space Difficulty Note Status
007 Reverse Integer Python O(1) O(1) Medium 0x7FFFFFFF, amazon, apple OK* (3)
009 Palindrome Number Python O(1) O(1) Easy amazon OK
012 Integer to Roman Python O(n) O(1) Medium math basic,twitter, fb, amazon, math AGAIN****** (4)
013 Roman to Integer Python O(n) O(1) Easy UBER,amazon, fb AGAIN***** (4)
029 Divide Two Integers Python O(1) O(1) Medium binary search,trick,fb AGAIN***** (3)
050 Pow(x, n) Python, Java O(1) O(1) Medium good trick,amazon, fb, recursion AGAIN****** (4)
060 Permutation Sequence Python O(n^2) O(n) Medium Cantor Ordering,trick ,amazon AGAIN*** (2)
089 Gray Code Python O(2^n) O(1) Medium bit op, math, amazon AGAIN ********** (6)
166 Fraction to Recurring Decimal Python O(logn) O(1) Medium AGAIN (not start)
168 Excel Sheet Column Title Python O(logn) O(1) Easy trick, residual, math, AGAIN,fb AGAIN****** (5)
171 Excel Sheet Column Number Python O(n) O(1) Easy AGAIN (not start)
172 Factorial Trailing Zeroes Python O(1) O(1) Easy basic, iteration, recursion AGAIN* (2)
223 Rectangle Area Python O(1) O(1) Easy AGAIN
258 Add Digits Python O(1) O(1) Easy AGAIN
263 Ugly Number Python O(1) O(1) Easy math OK* (2)
273 Integer to English Words Python O(1) O(1) Hard amazon, passed not start
292 Nim Game Python O(1) O(1) Easy LintCode OK*
319 Bulb Switcher Python O(1) O(1) Medium AGAIN
326 Power of Three Python O(1) O(1) Easy OK
338 Counting Bits Python, Java O(n) O(n) Medium Curated Top 75 OK
343 Integer Break Python O(logn) O(1) Medium trick, DP AGAIN* (2)
365 Water and Jug Problem Python O(logn) O(1) Medium Bézout's identity AGAIN (not start)
372 Super Pow Python O(n) O(1) Medium AGAIN
382 Linked List Random Node Python O(n) O(1) Medium Reservoir Sampling AGAIN (not start)
386 Lexicographical Numbers Python O(n) O(1) Medium AGAIN (not start)
390 Elimination Game Python O(logn) O(1) Medium AGAIN (not start)
398 Random Pick Index Python O(n) O(1) Medium Reservoir Sampling , fb OK* (4)
400 Nth Digit Python O(logn) O(1) Easy AGAIN
413 Arithmetic Slices Python O(n) O(1) Medium sliding window, amazon OK*** (1) (but again)
423 Reconstruct Original Digits from English Python O(n) O(1) Medium GCJ2016 - Round 1B AGAIN (not start)
441 Arranging Coins Python O(nlogn) O(1) Easy Binary Search OK
453 Minimum Moves to Equal Array Elements Python O(n) O(1) Easy AGAIN
458 Poor Pigs Python O(n) O(1) Easy AGAIN
469 Convex Polygon Python O(n) O(1) Medium 🔒 AGAIN (not start)
470 Implement Rand10() Using Rand7() Python O(1) O(1) Medium AGAIN (not start)
478 Generate Random Point in a Circle Python O(1) O(1) Medium AGAIN (not start)
497 Random Point in Non-overlapping Rectangles Python ctor: O(n)
pick: O(logn)
O(n) Medium AGAIN (not start)
504 Base 7 Python binary, math, good basic O(n) Easy AGAIN******** (1)
519 Random Flip Matrix Python ctor: O(1)
pick: O(1) reset: O(n)
O(n) Medium AGAIN (not start)
528 Random Pick with Weight Python, Java O(logn) O(n) Medium good basic, binary search, prefix sum, google AGAIN**** (1)
537 Complex Number Multiplication Python O(1) O(1) Medium math, amazon OK (3)
553 Optimal Division Python O(n) O(1) Medium string, math, amazon OK* (4)
573 Squirrel Simulation Python O(n) O(1) Medium 🔒 AGAIN (not start)
592 Fraction Addition and Subtraction Python O(nlogx) O(n) Medium AGAIN
593 Valid Square Python O(1) O(1) Medium AGAIN
598 Range Addition II Python O(p) O(1) Easy AGAIN
625 Minimum Factorization Python O(loga) O(1) Medium 🔒 OK*
628 Maximum Product of Three Numbers Python O(n) O(1) Easy amazon OK (2)
633 Sum of Square Numbers Python O(sqrt(c) * logc) O(1) Easy OK*
634 Find the Derangement of An Array Python O(n) O(1) Medium 🔒 AGAIN (not start)
640 Solve the Equation Python O(n) O(n) Medium math, regular expression, amazon AGAIN*** (3)
651 4 Keys Keyboard Python O(1) O(1) Medium 🔒, Math, DP AGAIN (not start)
672 Bulb Switcher II Python O(1) O(1) Medium AGAIN (not start)
728 Self Dividing Numbers Python O(n) O(1) Medium AGAIN
754 Reach a Number Python O(logn) O(1) Medium OK*
775 Global and Local Inversions Python O(n) O(1) Medium trick, math, string, amazon AGAIN** (not start) (3)
779 K-th Symbol in Grammar Python O(1) O(1) Medium math, brute force, binary, recursion, FB, amazon AGAIN*** (1)
781 Rabbits in Forest Python O(n) O(n) Medium AGAIN (not start)
789 Escape The Ghosts Python O(n) O(1) Medium AGAIN
800 Similar RGB Color Python O(1) O(1) Easy 🔒 AGAIN (not start)
812 Largest Triangle Area Python O(n^3) O(1) Easy AGAIN (not start)
829 Consecutive Numbers Sum Python O(sqrt(n)) O(1) Medium AGAIN
836 Rectangle Overlap Python O(1) O(1) Easy similar as 223. Rectangle Area, amazon AGAIN (2)
858 Mirror Reflection Python O(1) O(1) Medium AGAIN (not start)
867 Prime Palindrome Python O(n^(1/2) * (logn + n^(1/2))) O(logn) Medium AGAIN***
883 Projection Area of 3D Shapes Python O(n^2) O(1) Easy AGAIN
891 Sum of Subsequence Widths Python O(n^2) O(1) Hard amazon AGAIN (not start)
907 Sum of Subarray Minimums Python O(n) O(n) Medium trick, LC 084, LC 2104, Ascending Stack, amazon AGAIN**** (1)
908 Smallest Range I Python O(n) O(1) Easy OK* (2)
910 Smallest Range II Python O(nlogn) O(1) Medium AGAIN (not start)
914 X of a Kind in a Deck of Cards Python O(n * (logn)^2) O(n) Easy AGAIN (not start)
963 Minimum Area Rectangle II Python O(n^2) ~ O(n^3) O(n^2) Medium AGAIN (not start)
970 Powerful Integers Python O((logn)^2) O(r) Easy basic AGAIN* (2)
517 Super Washing Machines Python Hard amazon AGAIN (not start)
1342 Number of Steps to Reduce a Number to Zero Python easy gra* ok
1492 The kth Factor of n Python Medium amazon AGAIN (not start)
1979 Find Greatest Common Divisor of Array Python Easy GCD not start
2013 Detect Squares Java Medium math not start
3190 Find Minimum Operations to Make All Elements Divisible by Three Java Easy LC weekly, math OK
3194 Minimum Average of Smallest and Largest Elements Java Easy LC weekly, math OK

Sort

# Title Solution Time Space Difficulty Note Status
075 Sort Colors Python O(n) O(1) Medium sorting, Tri Partition,two pointers, M$, fb OK** (4)
088 Merge Sorted Array Python, Java O(n) O(1) Easy good basic, merge, sort,two pointers, M$, amazon,fb AGAIN************* (8) (MUST)
128 Longest Consecutive Sequence Python, Java Medium Curated Top 75, 2 pointers, sort, sliding window, amazon AGAIN*********** (4) (MUST)
147 Insertion Sort List Python O(n^2) O(1) Medium trick AGAIN* (2)
148 Sort List Python O(nlogn) O(logn) Medium basic, check # 21 Merge Two Sorted Lists AGAIN** (2)
179 Largest Number Python O(nlogn) O(1) Medium good basic, sort with lambda,amazon AGAIN************ (3)
252 Meeting Rooms Python, Java O(nlogn) O(n) Easy Curated Top 75, sort, 🔒,UBER,amazon, fb OK*** (4) (but again)
253 Meeting Rooms II Python, Java O(nlogn) O(n) Medium Curated Top 75, 🔒, sort, priority queue (min-heap),scanning line, trick,booking.com,good,UBER, amazon,google,fb AGAIN************ (5) (MUST)
274 H-Index Python O(n) O(n) Medium Counting Sort,good trick, fb AGAIN***** (3)
280 Wiggle Sort Python O(n) O(1) Medium 🔒,google,fb OK*** (3)
324 Wiggle Sort II Python O(n) on average O(1) Medium variant of Sort Colors , Tri Partition, google AGAIN** (2)
347 Top K Frequent Elements Python, Java O(n) O(n) Medium Curated Top 75 , HashMap, Heap, Sort,Yelp,amazon,fb, GOOD basic AGAIN******** (4)
406 Queue Reconstruction by Height Python, Java O(n * sqrt(n)) O(n) Medium basic,trick, sort by key, insert, google AGAIN********* (5)
451 Sort Characters By Frequency Python O(n) O(n) Medium collections.Counter(s).most_common,sorted(count_dict.items() with lambda,good basic, amazon OK* (4)
692 Top K Frequent Words Python O(n + klogk) on average O(n) Medium good basic,Quick Select, Heap, Bucket Sort, heapq, yelp, UBER,amazon,fb OK***** (5)
937 Reorder Data in Log Files Python O(nlogn * l) O(l) Medium good basic, sort, string, amazon OK**** (3)(again!!!)
969 Pancake Sorting Python O(n^2) O(l) Medium fb, sorting AGAIN********** (4)
973 K Closest Points to Origin Python, Java O(n) on average O(1) Medium sort with lambda, Quick Select, Heap, amazon OK* (3)
976 Largest Perimeter Triangle Python, Java O(nlogn) O(1) Easy OK* (2)
912 Sort an Array Python O(nlogn) O(1) Medium sort, merge sort, quick sort, apple, amazon, m$ AGAIN** (1)
1057 Campus Bike Java O(nlogn) O(1) Medium sorting, google AGAIN
1066 Campus Bike II Java O(nlogn) O(1) Medium sorting, google AGAIN
1152 Analyze User Website Visit Pattern Python O(nlogn) O(1) Medium itertools.combinations, sort, brute force, set, amazon AGAIN***** (2) (not start)
2021 Brightest Position on Street Python O(nlogn) O(1) Medium LC 253 meeting room II, priority queue (min-heap), scanning line, trick, amazon AGAIN*********** (3) (MUST)

Two Pointers

# Title Solution Time Space Difficulty Note Status
019 Remove Nth Node From End of List Python, Java O(n) O(1) Medium Curated Top 75, good basic, MUST, linked list,two pointers,fb AGAIN********** (4) (MUST)
042 Trapping Rain Water Python, Java Hard scan, dp, trick, two pointer, amazon, apple AGAIN*** (2) (not start)
086 Partition List Python O(n) O(1) Medium OK*
141 Linked List Cycle Python, Java O(n) O(1) Easy Curated Top 75, basic,amazon, fb, linked list, 2 pointers, check #142 OK** (5)
142 Linked List Cycle II Python O(n) O(1) Medium linked list, 2 pointers, check #141 AGAIN****** (4) (again!)
143 Reorder List Python, Java O(n) O(1) Medium Curated Top 75, LC 021, 206, 876, good trick,inverse linkedlist, merge linkedlist ,fb, amazon AGAIN********** (5) (MUST)
167 Two Sum II - Input array is sorted Python, Java O(n) O(1) Medium two pointer, dict, binary search,good basic, amazon OK* (6)
259 3Sum Smaller Python O(n^2) O(1) Medium 🔒, LintCode, good trick, google, fb, check #015 3 Sum, check #001 two sum AGAIN******** (4)
283 Move Zeroes Python, Java O(n) O(1) Easy basic, trick, ,two pointers,Shopee,fb AGAIN** (5)
344 Reverse String Python O(n) O(1) Easy OK
345 Reverse Vowels of a String Python, Java O(n) O(1) Easy google OK** (1)
349 Intersection of Two Arrays Python O(m + n) O(min(m, n)) Easy EPI, Hash, Binary Search, fb OK
350 Intersection of Two Arrays II Python O(m + n) O(1) Easy EPI, Hash, Binary Search, good basic, fb OK** (3)
360 Sort Transformed Array Python O(n) O(1) Medium trick,🔒,google ,fb AGAIN*** (3)
457 Circular Array Loop Python O(n) O(1) Medium AGAIN (not start)
567 Permutation in String Python, Java O(n) O(1) Medium Collections.counter,sliding window, sorting, hashmap,substring, good basic,M$, fb AGAIN********* (8)
611 Valid Triangle Number Python O(n^2) O(1) Medium AGAIN (not start)
777 Swap Adjacent in LR String Python O(n) O(1) Medium AGAIN (not start)
826 Most Profit Assigning Work Python O(mlogm + nlogn) O(n) Medium trick, good basic, zip+sorted OK*
844 Backspace String Compare Python, Java O(m + n) O(1) Easy good basic,stack,google, fb OK* (4)
876 Middle of the Linked List Python, Java O(n) O(1) Easy basic, amazon, apple, google, 2 pointers, linkedlist OK* (2)
904 Fruit Into Baskets Python O(n) O(1) Medium AGAIN (not start)
930 Binary Subarrays With Sum Python O(n) O(1) Medium trick AGAIN* (2) (not start)
977 Squares of a Sorted Array Python O(n) O(1) Easy OK
1055 Shortest Way to Form String Python, Java O(n) O(h) Medium 2 pointer, google again
1151 Minimum Swaps to Group All 1's Together Python O(n) O(1) Medium good basic, 2 pointers, Deque (Double-ended Queue), amazon AGAIN***** (not start )
1963 Minimum Number of Swaps to Make the String Balanced Python O(n) O(h) Medium good basic, greedy, stack, 2 pointers, amazon, fb, m$ AGAIN******** (2)
2104 Sum of Subarray Ranges Python O(n) O(1) Medium LC 907, monotonic stack, brute force, 2 pointers, dp, amazon AGAIN******* (3)
3191 Minimum Operations to Make Binary Array Elements Equal to One I Java O(n) O(h) Medium 2 pointers Again* (2)
3192 Minimum Operations to Make Binary Array Elements Equal to One II Java O(n) O(h) Medium 2 pointers Again* (2)

Recursion

# Title Solution Time Space Difficulty Note Status
10 Regular Expression Matching Python O(n) O(h) Hard recursive, dp, amazon AGAIN (not start)
095 Unique Binary Search Trees II Python O(4^n / n^(3/2) O(4^n / n^(3/2) Medium recursion, BST, amazon, google, apple AGAIN!!! (1)(good trick)
098 Validate Binary Search Tree Python, Java O(n) O(1) Medium Curated Top 75, recursion, bfs, dfs,BST,M$,amazon, fb AGAIN****************** (11)
100 Same Tree Python, Java O(n) O(h) Easy Curated Top 75, recursion, dfs, bfs, good basic,amazon OK****** (5) (but again)
104 Maximum Depth of Binary Tree Python, Java O(n) O(h) Easy Curated Top 75, DFS, BFS, good basic,amazon, LC 111 OK******** (4) (but again)
105 Construct Binary Tree from Preorder and Inorder Traversal Python, Java O(n) O(n) Medium Curated Top 75, trick, check # 106,BST,M$, fb AGAIN********* (9)
106 Construct Binary Tree from Inorder and Postorder Traversal Python, Java O(n) O(n) Medium trick,check # 105,BST,M$, fb AGAIN******* (6)
108 Convert Sorted Array to Binary Search Tree Python O(n) O(logn) Medium good concept AGAIN*
109 Convert Sorted List to Binary Search Tree Python O(n) O(logn) Medium list,BST,good concept, fb AGAIN*** (3)
110 Balanced Binary Tree Python, Java O(n) O(h) Easy good trick,dfs,amazon ,fb, google, top-down, bottom-up recursion AGAIN************ (6)(MUST)
111 Minimum Depth of Binary Tree Python, Java O(n) O(h) Easy good basic,dfs,BST,amazon,fb, LC 104 AGAIN******** (5)
114 Flatten Binary Tree to Linked List Python O(n) O(h) Medium BST, dfs, M$, fb AGAIN**** (4)
116 Populating Next Right Pointers in Each Node Python O(n) O(1) Medium bfs, dfs, tree, recursion ,AGAIN,fb, amazon AGAIN****** (5)
117 Populating Next Right Pointers in Each Node II Python O(n) O(h) Medium Populating Next Right Pointers in Each Node I, bfs, linked list, amazon, fb AGAIN****** (3)
129 Sum Root to Leaf Numbers Python O(n) O(h) Medium trick,BST, dfs, fb AGAIN*** (4)
156 Binary Tree Upside Down Python O(n) O(1) Medium 🔒 AGAIN (not start)
241 Different Ways to Add Parentheses Python O(n * 4^n / n^(3/2)) O(n * 4^n / n^(3/2)) Medium AGAIN (not start)
298 Binary Tree Longest Consecutive Sequence Python, Java O(n) O(h) Medium good basic, bfs, dfs, tree, 🔒, google OK***** (3)
333 Largest BST Subtree Python O(n) O(h) Medium 🔒 AGAIN (not start)
337 House Robber III Python O(n) O(h) Medium amazon, google AGAIN (not start)
395 Longest Substring with At Least K Repeating Characters Python O(n) O(1) Medium AGAIN,recursion, good trick,fb AGAIN************ (4)
404 Sum of Left Leaves Python, Java O(n) O(h) Easy, tree, bfs, dfs, amazon AGAIN**** (4)
437 Path Sum III Python O(n) O(h) Medium good trick,UBER, AMAZON, fb AGAIN*** (3)
544 Output Contest Matches Python O(n) O(n) Medium AGAIN
549 Binary Tree Longest Consecutive Sequence II Python O(n) O(h) Medium 🔒 AGAIN (not start)
669 Trim a Binary Search Tree Python O(n) O(h) Medium good basic, BST, dfs, recursion,amazon AGAIN******* (4)
671 Second Minimum Node In a Binary Tree Python O(n) O(h) Easy dfs,tree OK* (2)
753 Cracking the Safes Java O(n) O(h) Hard dfs,recursion,google AGAIN (not start)
1145 Binary Tree Coloring Game Java O(n) O(h) Medium tree,recursion,google AGAIN (not start)

Binary Search

# Title Solution Time Space Difficulty Tag, Note Status
033 Search in Rotated Sorted Array Python, Java Medium Curated Top 75, binary search,good basic ,check # 81 Search in Rotated Sorted Array II, binary search, rotation array, UBER,amazon,fb AGAIN************ (6) (MUST)
034 Find First and Last Position of Element in Sorted Array Python O(n) O(1) Medium binary search, LC top 100 like, amazon, fb, google, apple, uber AGAIN************** (4) (MUST)
034 Search for a Range Python O(logn) O(1) Medium AGAIN*
035 Search Insert Position Python O(logn) O(1) Medium AGAIN
069 Sqrt(x) Python O(logn) O(1) Medium math, binary search,amazon,fb OK* (4)
074 Search a 2D Matrix Python, Java O(logm + logn) O(1) Medium binary search in 2D array, flatten matrix,amazon OK**** (BUT AGAIN)(3)
081 Search in Rotated Sorted Array II Python O(logn) O(1) Medium binary search,check # 33 Search in Rotated Sorted Array first,array, fb, amazon, linkedin OK***** (6)
153 Find Minimum in Rotated Sorted Array Python, Java O(logn) O(1) Medium Curated Top 75, binary search, ascending array, good basic,amazon AGAIN********** (5)(MUST)
162 Find Peak Element Python, Java O(logn) O(1) Medium good trick, recursive, iterative binary search,M$, google, fb AGAIN********** (6)
222 Count Complete Tree Nodes Python, Java O((logn)^2) O(1) Easy google, tree OK (again)
275 H-Index II Python O(logn) O(1) Medium similar as # 274 H-Index, Binary Search, fb AGAIN**** (3)
278 First Bad Version Python, Java O(logn) O(1) Easy good basic,LintCode, binary search, fb OK*** (5) (MUST)
300 Longest Increasing Subsequence Python, Java O(nlogn) O(n) Medium Curated Top 75, array, binary search,DP good basic, LintCode, DP,amazon,fb AGAIN********** (10)
315 Count of Smaller Numbers After Self Python, Java O(logn) O(1) Hard binary search, BST, BIT, google again*
367 Valid Perfect Square Python, Java O(logn) O(1) Easy good basic, similar as # 69 Sqrt(x) OK* (3)
374 Guess Number Higher or Lower Python O(logn) O(1) Easy OK*
410 Split Array Largest Sum Python, Java O(logn) O(1) Hard google AGAIN (not start)
436 Find Right Interval Python O(nlogn) O(n) Medium AGAIN (not start)
475 Heaters Python O((m + n) * logn) O(1) Easy AGAIN (not start)
540 Single Element in a Sorted Array Python O(logn) O(1) Medium OK*
658 Find K Closest Elements Python O(logn + k) O(1) Medium good trick, sorting, stack, two pointers,binary search,amazon,fb, google AGAIN ************** (5) (MUST)
744 Find Smallest Letter Greater Than Target Python O(logn) O(1) Easy OK*
852 Peak Index in a Mountain Array Python O(logn) O(1) Medium LC 162 Find Peak Element, amazon OK* (2)
875 Koko Eating Bananas Python, Java O(nlogr) O(1) Medium binary search, left boundary, good basic AGAIN******* (4)(MUST)
894 All Possible Full Binary Trees Python O(n * 4^n / n^(3/2)) O(n * 4^n / n^(3/2)) Medium AGAIN (not start)
911 Online Election Python ctor: O(n)
query : O(logn)
O(n) Medium AGAIN (not start)
981 Time Based Key-Value Store Python, Java O(n) Medium binary search, dict, treeMap, floorKey, sort, apple, M$, amz, google AGAIN****** (2)
1011 Capacity To Ship Packages Within D Days Python, Java Medium good trick, binary search, amazon, apple, fb, m$, google AGAIN****** (3)
1889 Minimum Space Wasted From Packaging Python Hard heap, prefix sum, binary search, amazon AGAIN (not start)
2009 Minimum Number of Operations to Make Array Continuous Python Hard binary search, sliding window, dequeue, bisect.bisect_right, amazon AGAIN (not start)

Binary Search Tree

# Title Solution Time Space Difficulty Tag,Note Status
220 Contains Duplicate III Python O(nlogk) O(k) Medium AGAIN (not start)
230 Kth Smallest Element in a BST Python, Java O(max(h, k)) O(min(h, k)) Medium Curated Top 75, good basic BST basic, DFS, BFS, STACK, BST,amazon OK********* (4)
235 Lowest Common Ancestor of a Binary Search Tree Python, Java O(h) O(1) Medium Curated Top 75, BST, recursion, iteration, good basic, LCA, check # 236 Lowest Common Ancestor of a Binary Tree, amazon,fb OK**************** (but again)(10)
270 Closest Binary Search Tree Value Python O(h) O(1) Easy good basic ,🔒, M$, BST, google,fb OK***** (5)
285 Inorder Successor in BST Python O(h) O(1) Medium BST, dfs, good basic, 🔒,amazon,fb OK** (4)
449 Serialize and Deserialize BST Python O(n) O(h) Medium LC 297, dfs, bfs, good trick,serizlize deserizlize, tree, amazon, fb AGAIN************* (9) (MUST)
450 Delete Node in a BST Python O(h) O(h) Medium AGAIN, good trick, BST, tree, dfs AGAIN****** (6) (but again)
530 Minimum Absolute Difference in BST Python O(n) O(h) Easy AGAIN*
700 Search in a Binary Search Tree Python, Java O(n) O(h) Easy BST, good basic, recursion, iteration amazon AGAIN*** (1)
776 Split BST Python, Java O(n) O(h) Medium 🔒, BST, DFS, trick, AGAIN ,amazon, google AGAIN********* (6)
783 Minimum Distance Between BST Nodes Python O(n) O(h) Easy OK*
426 Convert Binary Search Tree to Sorted Doubly Linked List Python Medium recursion, tree, linked list, good basic UBER, lyft, amazon, google,fb AGAIN******* (5) (not start)
968 Binary Tree Cameras Python O(n) Hard amazon, dfs, bst, dp, greedy, m$ AGAIN (not start)
1022 Sum of Root To Leaf Binary Numbers Python O(n) Easy good basic, LC 257, bst path, dfs, bfs,amazon AGAIN******** (1) (MUST)
1597 Build Binary Expression Tree From Infix Expression Python O(n) Hard LC 224, recursive, iteration, stack, amazon, google, bst AGAIN*** (1)

Breadth-First Search

# Title Solution Time Space Difficulty Tag Status
102 Binary Tree Level Order Traversal Python, Java O(n) O(n) Easy Curated Top 75, GOOD basic, dfs, bfs,UBER, apple,amazon,fb, LC 199 AGAIN******* (8) (must)
107 Binary Tree Level Order Traversal II Python, Java O(n) O(n) Easy same as # 102 Binary Tree Level Order Traversal OK* (3)
103 Binary Tree Zigzag Level Order Traversal Python O(n) O(n) Medium amazon,fb OK
126 Word Ladder II Python Hard complex, trick, dfs, bfs, dfs+bfs, check # 127 Word Ladder,amazon AGAIN*** (3)
127 Word Ladder Python, Java O(n * d) O(d) Hard/Medium good basic, check #126 Word Ladder II, bfs, UBER, amazon, M$, fb AGAIN************** (9)
130 Surrounded Regions Python, Java O(m + n) Medium bfs, dfs,union find,good basic, amazon AGAIN*********** (5)
133 Clone Graph Python, Java O(n) O(n) Medium Curated Top 75, good trick, check #138 Copy List with Random Pointer ,graph,dfs,bfs, UBER, google,amazon,fb AGAIN**************** (10) (MUST)
207 Course Schedule Python, Java O(|V| + |E|) O(|E|) Medium Curated Top 75, Topological Sort, LC 210, good trick,dfs, bfs , amazon,fb AGAIN**************** (14) (MUST)
210 Course Schedule II Python, Java O(|V| + |E|) O(|E|) Medium Topological Sort,LC 207, dfs ,amazon ,fb AGAIN********* (10) (again)
261 Graph Valid Tree Python, Java O(|V| + |E|) O(|V| + |E|) Medium Curated Top 75, AGAIN, bfs, dfs, grpah, 🔒, graph,quick union,union find ,google,amazon,fb AGAIN************* (11)(MUST)
286 Walls and Gates Python, Java O(m * n) O(g) Medium 🔒, dfs, bfs , good basic, google,amazon,FB AGAIN******** (7)
310 Minimum Height Trees Python O(n) O(n) Medium complex AGAIN (3) (not start)
433 Minimum Genetic Mutation Python O(n * b) O(b) Medium check # 127 Word Ladder, good basic AGAIN*** (3)
444 Sequence Reconstruction Python, Java O(n * s) O(n) Medium good trick, Topological Sort , google, airbnb AGAIN******* (4) (not start)
490 The Maze Python O(max(r, c) * w) O(w) Medium basic, bfs, dfs,amazon,fb AGAIN**** (5)
505 The Maze II Python O(max(r, c) * wlogw) O(w) Medium trick,bfs,dfs,AGAIN, google, fb AGAIN********* (6)
542 01 Matrix Python O(m * n) O(m * n) Medium DP, trick,queue AGAIN*** (3)
666 Path Sum IV Python O(n) O(w) Medium 🔒 Topological Sort AGAIN* (3) (not start)
742 Closest Leaf in a Binary Tree Python, Java O(n) O(n) Medium AGAIN, Graph, bfs+dfs, search, good trick, amazon AGAIN********** (6)
743 Network Delay Time Python, Java O(n) O(n) Medium Dijlstra, google AGAIN **** (2)
752 Open the Lock Python O(k * n^k + d) O(k * n^k + d) Medium LC 863 AGAIN (not start)
787 Cheapest Flights Within K Stops Python O(|E| * log|V|) O(|E|) Medium Dijkstra's algorithm, dfs, bfs, graph, priority queue,amazon, apple, google, airbnb AGAIN****** (3) (not start)
815 Bus Routes Python O(|E| * log|V|) O(|E|) Hard shortest route, graph, bfs,amazon AGAIN*** (2) (not start)
886 Possible Bipartition Python O(|V| + |E|) O(|V| + |E|) Medium check # 785 Is Graph Bipartite?,graph, AGAIN,union find ,fb AGAIN********** (6)
934 Shortest Bridge Python O(n^2) O(n^2) Medium BFS, DFS, complex AGAIN (not start)
967 Numbers With Same Consecutive Differences Python O(2^n) O(2^n) Medium good trick AGAIN** (3)
675 Cut Off Trees for Golf Event Python, Java Hard tree, BFS, complex, amazon AGAIN (not start)
864 Shortest Path to Get All Keys Python Hard BFS, amazon AGAIN (not start)
994 Rotting Oranges Python, Java Medium BFS, dp amazon OK** (2)
1110 Delete Nodes And Return Forest Python, Java Medium BFS, recursive google not start
1162 As Far from Land as Possible Python Medium dfs, bfs, good basic, amazon AGAIN**** (3)
1197 Minimum Knight Moves Java Medium BFS, google OK (1)
1730 Shortest Path to Get Food Python Medium shortest path, bfs, amazon OK (2)

Depth-First Search

# Title Solution Time Space Difficulty Tag Status
112 Path Sum Python, Scala, Java O(n) O(h) Easy good concept, amazon, dfs, recursion AGAIN** (2)
113 Path Sum II Python, Java O(n) O(h) Medium dfs, backtrack, LC 112 Path Sum,good basic, amazon, fb AGAIN****** (6)
199 Binary Tree Right Side View Python, Java O(n) O(h) Medium good basic, dfs, bfs,apple,amazon, fb, LC 102 OK*** (6)
200 Number of Islands Python, Java O(m * n) O(m * n) Medium Curated Top 75, bfs, dfs,good basic,check # 694, 711 Number of Distinct Islands,apple, Goldman Sachs,google,amazon,fb OK****** (6)
236 Lowest Common Ancestor of a Binary Tree Python, Java O(n) O(h) Medium trick,EPI, LCA,check 235 Lowest Common Ancestor of a Binary Search Tree,apple,amazon,linkedin,fb AGAIN************* (9)
247 Strobogrammatic Number II Python O(n^2 * 5^(n/2)) O(n) Medium 🔒,check #246 Strobogrammatic Number,good trick, google,fb AGAIN******** (4)
250 Count Univalue Subtrees Python O(n) O(h) Medium 🔒 AGAIN (not start)
257 Binary Tree Paths Python, Java O(n * h) O(h) Easy good basic,apple, google, amazon, fb, iterative, dfs, LC 112, 113 AGAIN********* (MUST) (7)
332 Reconstruct Itinerary Python O(t! / (n1! * n2! * ... nk!)) O(t) Medium yelp, google AGAIN* (3) (not start)
339 Nested List Weight Sum Python O(n) O(h) Easy 🔒,good basic,bfs, linkedin, fb AGAIN*** (3)
364 Nested List Weight Sum II Python O(n) O(h) Medium 🔒, linkedin AGAIN*
366 Find Leaves of Binary Tree Python O(n) O(h) Medium 🔒, linkedin AGAIN*
399 Evaluate Division Python O(q * |V|!) O(e) Medium union find, dfs, AGAIN, good trick google, fb AGAIN*********** (6)
417 Pacific Atlantic Water Flow Python, Java O(m * n) O(m * n) Medium Curated Top 75, 2 direction dfs, dfs, matrix, m$,google AGAIN** (3)
464 Can I Win Python O(n!) O(n) Medium DP, linkedin AGAIN* (not start)
491 Increasing Subsequences Python Medium trick,dfs,dfs good trick, dp,yahoo ,fb AGAIN***** (2)
515 Find Largest Value in Each Tree Row Python O(n) O(h) Medium good basic,linkedin AGAIN* (3)
529 Minesweeper Python Medium dfs, bfs, good basic, dfs, bfs,amazon AGAIN**** (4)
547 Friend Circles Python O(n^2) O(n) Medium graph, Union Find,dfs, bfs,check # 733 Flood Fill,bloomberg ,fb AGAIN*** (3) (not start)
547 Number of Provinces Python O(n^2) O(n) Medium dfs, bfs, graph, union find, good basic, apple, amazon AGAIN************ (2) (MUST)
582 Kill Process Python O(n) O(n) Medium 🔒, DFS, BFS,good basic ,bloomberg, amazon AGAIN***** (4)
638 Shopping Offers Python O(n * 2^n) O(n) Medium google AGAIN (not start*)
690 Employee Importance Python O(n) O(h) Easy DFS, BFS,good basic ,UBER OK** (3)
694 Number of Distinct Islands Python O(m * n) O(m * n) Medium #200, #711 Number of Islands good pattern, dfs, 🔒, compare with # 200 Number of Islands, amazon AGAIN******** (5)
695 Max Area of Island Python, Java O(m * n) O(m * n) Medium amazon, microsoft, linkedin, basic AGAIN* (3)
711 Number of Distinct Islands II Python, Java Hard complex, dfs, check # 200, 694 Number of Distinct Islands,amazon OK*** (3)
721 Accounts Merge Python O(nlogn) O(n) Medium dfs, Disjoint Set Union (DSU), Union Find,path compression, complex, fb, google, amazon, m$, apple, twitter AGAIN******* (4) (not start)
733 Flood Fill Python O(m * n) O(m * n) Easy fb, amazon, good basic OK**** (5)
737 Sentence Similarity II Python, Java O(m * n) O(m * n) Medium dfs, union find, dis-joint, google AGAIN**** (2)
756 Pyramid Transition Matrix Python O(a^b) O(a^b) Medium AGAIN (3) (not start)
785 Is Graph Bipartite? Python O(|V| + |E|) O(|V|) Medium check #886 Possible Bipartition,AGAIN,graph,dfs,fb, amazon AGAIN*********** (6)
797 All Paths From Source to Target Python O(p + r * n) O(n) Medium graph, dfs classics, good basic AGAIN** (3)
802 Find Eventual Safe States Python, Java O(|V| + |E|) O(|V|) Medium Topological Sort, dfs, bfd, graph, google AGAIN (4) (not start)
841 Keys and Rooms Python O(n!) O(n) Medium google, bfs, dfs, good basic AGAIN*** (3)
851 Loud and Rich Python O(q + r) O(q + r) Medium amazon,defaultdict, good basic AGAIN*** (3)
1087 Brace Explansion Java O(q + r) O(q + r) Medium dfs, backtrack, good trick, google AGAIN*** (1)
1192 Critical Connections in a Network Python O(q + r) O(q + r) Hard Tarjan's algorithm,dfs, graph, fb, amazon AGAIN** (1) (not start)
1644 Lowest Common Ancestor of a Binary Tree II Python O(q + r) O(q + r) Medium LCA, LC 236, m$, fb AGAIN (not start)
1650 Lowest Common Ancestor of a Binary Tree III Python O(q + r) O(q + r) Medium parent node, good trick, dfs, set, dict, LCA, LC 236, amazon, google, spotify m$, fb AGAIN******** (2) (MUST)
1676 Lowest Common Ancestor of a Binary Tree IV Python O(q + r) O(q + r) Medium LCA, LC 236, a m$ AGAIN (not start)

Backtracking

# Title Solution Time Space Difficulty Tag, Note Status
017 Letter Combinations of a Phone Number Python, Java O(n * 4^n) O(n) Medium dfs, backtrack, good trick,UBER, amazon, google, fb AGAIN************* (10) (MUST)
022 Generate Parentheses Python, Java O(4^n / n^(3/2)) O(n) Medium LC 20, good basic, stack, backtrac, Divide and Conquer, amazon OK**************** (5) (but again, MUST)
037 Sudoku Solver Python O(4^n / n^(3/2)) O(n) Hard backtrack, google, amazon, uber AGAIN(not start)
039 Combination Sum Python, Java O(k * n^k) O(k) Medium backtrack,dfs,good basic,UBER, airbnb, amazon,fb OK********* (7) (but again)
040 Combination Sum II Python, Java O(k * C(n, k)) O(k) Medium similar as #39 Combination Sum AGAIN*** (3) (again)
046 Permutations Python, Java O(n * n!) O(n) Medium backtrack, LC #77, 78, good concept, M$, linkedin, amazon,fb OK*********** (4) (AGAIN, MUST)
047 Permutations II Python O(n * n!) O(n) Medium similar as #46 Permutations, apple, amazon, m$ AGAIN (not start)
052 N-Queens II Python O(n^2) O(1) Hard matrix, backtrack AGAIN
077 Combinations Python, Java O(O(k * C(n, k))) O(k) Medium good trick, backtrack OK************* (5) (but again, MUST)
079 Word Search Python, Java O(m * n * l) O(l) Medium LC 212, Curated Top 75, back tracking,good trick,dfs,bloomberg, M$, amazon,fb AGAIN*************** (10) (MUST)
093 Restore IP Addresses Python O(1) O(1) Medium good trick,recursive,IP address,amazon AGAIN****** (4)
078 Subsets Python, Java O(n * 2^n) O(1) Medium good concept , similar as, dfs, back track, #90 Subsets II , UBER, amazon, fb AGAIN**************** (7) (MUST again!!!)
090 Subsets II Python, Java O(n * 2^n) O(1) Medium good basic,check # 078 Subsets, dfs, backtrack, fb AGAIN********* (6)
131 Palindrome Partitioning Python, Java O(n^2) ~ O(2^n) O(n^2) Medium dfs, backtracking, good trick,amazon AGAIN*********** (6) (MUST)
139 Word Break Python, Java O(n * l^2) O(n) Medium Curated Top 75, backtracking, dfs, dp,trick,UBER,yahoo,amazon, google,fb AGAIN**************** (7) (MUST)
140 Word Break II Python O(n * l^2) O(n) Hard good basic, LC 078, backtracking, dfs, dp,trick, amazon AGAIN******** (2)
212 Word Search II Python, Java O(m * n * l) O(l) Hard Curated Top 75, LC 208, LC 079, hashset, hashmap, trie, backtrack with trie, amazon, fb, apple, twitter, uber, google, indeed AGAIN********** (3)
216 Combination Sum III Python O(k * C(n, k)) O(k) Medium AGAIN*
254 Factor Combinations Python O(nlogn) O(logn) Medium 🔒 AGAIN (not start)
267 Palindrome Permutation II Python O(n * n!) O(n) Medium 🔒 AGAIN (not start*)
294 Flip Game II Python O(n + c^2) O(c) Medium 🔒, DP, Hash AGAIN*
320 Generalized Abbreviation Python O(n * 2^n) O(n) Medium 🔒 AGAIN (not start*)
489 Robot Room Cleaner Python O(n * 2^n) O(n) Hard 🔒, google, amazon, fb, m$ AGAIN (not start)
526 Beautiful Arrangement Python O(n!) O(n) Medium AGAIN (not start*)
676 Implement Magic Dictionary Python O(n) O(d) Medium Trie, DFS AGAIN (not start)
698 Partition to K Equal Sum Subsets Python O(n * 2^n) O(2^n) Medium DFS, DP, Memoization, similar as #416 Partition Equal Subset Sum, #473 Matchsticks to Square AGAIN (not start*)
718 Maximum Length of Repeated Subarray Python O(m * n) O(min(m, n)) Medium DP, Hash, Binary Search AGAIN (not start*)
784 Letter Case Permutation Python O(n * 2^n) O(1) Medium dfs, recursion, good trick,fb AGAIN****** (3)
980 Unique Paths III Python O(n * 2^n) O(1) Hard backtrack, dfs, amazon, google,fb AGAIN**** (1)
1219 Path with Maximum Gold Java O(n * 2^n) O(1) Medium backtrack, dfs, bfs, google AGAIN**** (1)

Dynamic Programming

# Title Solution Time Space Difficulty Tag Status
053 Maximum Subarray Python, Java O(n) O(1) Medium Curated Top 75, brute force, pre-sum array,dp basic,amazon,fb AGAIN************* (7)
062 Unique Paths Python, Java O(m * n) O(m + n) Medium Curated Top 75, dp, basic, fb, google, apple, amazon, m$ AGAIN**** (2)
063 Unique Paths II Python O(m * n) O(m + n) Medium trick, check #062 Unique Paths, amazon AGAIN*
064 Minimum Path Sum Python O(m * n) O(m + n) Medium DP, amazon AGAIN*
070 Climbing Stairs Python, Java O(logn) O(1) Easy Curated Top 75, Matrix Exponentiation, DP, recursion, apple OK* (2)
072 Edit Distance Python O(logn) O(1) Hard top 100 like, DP, recursion, apple, google, amazon again (not start)
091 Decode Ways Python, Java O(n) O(1) Medium Curated Top 75, good basic,dp, M$, UBER, amazon,fb AGAIN************ (4)
096 Unique Binary Search Trees Python O(n) O(1) Medium dp, Math, fb, amazon AGAIN* (2) (not start)
120 Triangle Python O(m * n) O(n) Medium amazon AGAIN* (not start) (2)
123 Best Time to Buy and Sell Stock III Python O(m * n) O(n) Hard amazon, uber, apple AGAIN* (not start) (1)
152 Maximum Product Subarray Python, Java O(n) O(1) Medium dp, brute force, Curated Top 75, google, amazon, linkedin AGAIN***** (1)
198 House Robber Python, Java O(n) O(1) Easy Curated Top 75, dp basic,amazon AGAIN*** (2)
213 House Robber II Python, Java O(n) O(1) Medium brute force, recursion, dp, Curated Top 75, google, amazon OK**** (3) (but again)
221 Maximal Square Python, Java O(n^2) O(n) Medium EPI, dp, amazon,fb, google AGAIN** (3) (not start)
256 Paint House Python O(n) O(1) Medium 🔒 AGAIN (not start)
276 Paint Fence Python O(n) O(1) Easy 🔒 AGAIN
279 Perfect Squares Python O(n * sqrt(n)) O(n) Medium dp, bfs, trick, Hash, google AGAIN*
303 Range Sum Query - Immutable Python ctor: O(n), lookup: O(1) O(n) Easy OK
304 Range Sum Query 2D - Immutable Python ctor: O(m * n), lookup: O(1) O(m * n) Medium dp,trick,fb AGAIN******* (5)
309 Best Time to Buy and Sell Stock with Cooldown Python O(n) O(1) Medium AGAIN (not start)
322 Coin Change Python, Java O(n * k) O(k) Medium Curated Top 75, bfs, dfs, dp, grab, google, fb, apple, amazon AGAIN************* (6) (MUST)
351 Android Unlock Patterns Python O(9^2 * 2^9) O(9 * 2^9) Medium 🔒 Backtracking, DP, google AGAIN (not start)
357 Count Numbers with Unique Digits Python O(n) O(1) Medium Backtracking, Math AGAIN (not start)
361 Bomb Enemy Python O(m * n) O(m * n) Medium 🔒 , google AGAIN* (2)
363 Max Sum of Rectangle No Larger Than K Java O(m * n) O(m * n) Medium dp, pre-sum. google AGAIN* (not start)
368 Largest Divisible Subset Python O(n^2) O(n) Medium AGAIN (not start)
375 Guess Number Higher or Lower II Python O(n^2) O(n^2) Medium AGAIN (not start)
377 Combination Sum IV Python O(nlogn + n * t) O(t) Medium Curated Top 75, AGAIN, dp basic ,fb AGAIN******** (3)
403 Frog Jump Python O(nlogn + n * t) O(t) Hard dfs, bfs, Memoization dfs, dp, amazon, tik-tok, m$ AGAIN (not start)
416 Partition Equal Subset Sum Python O(n * s) O(s) Medium dp, fb, google, apple, amazon AGAIN** (not start) (1)
418 Sentence Screen Fitting Python O(r + n * c) O(n) Medium 🔒, dp, google AGAIN (not start)
467 Unique Substrings in Wraparound String Python O(n) O(1) Medium AGAIN (not start)
471 Encode String with Shortest Length Python O(n^3) on average O(n^2) Medium 🔒, dp, google AGAIN (not start)
472 Concatenated Words Python O(n * l^2) O(n * l) Hard good trick,trie+dfs, dp, dfs,amazon AGAIN******** (3)
474 Ones and Zeroes Python O(s * m * n) O(m * n) Medium dp, google AGAIN (not start)
486 Predict the Winner Python O(n^2) O(n) Medium good basic,dp, google AGAIN*****
509 Fibonacci Number Python O(logn) O(1) Easy variant of Climbing Stairs, Matrix Exponentiation, Spotify OK**
516 Longest Palindromic Subsequence Python O(n^2) O(n) Medium good DP basic,dp, UBER, amazon AGAIN******
562 Longest Line of Consecutive One in Matrix Python O(m * n) O(n) Medium 🔒, dp, google AGAIN (not start)
552 Student Attendance Record II Java O(m * n) O(n) Medium dp, google AGAIN (not start)
576 Out of Boundary Paths Python O(N * m * n) O(m * n) Medium dp, bfs AGAIN (not start)
583 Delete Operation for Two Strings Python O(m * n) O(n) Medium dp, google AGAIN (not start)
650 2 Keys Keyboard Python O(sqrt(n)) O(1) Medium dp,dp basic ,M$ AGAIN*
673 Number of Longest Increasing Subsequence Python O(n^2) O(n) Medium dp,good trick, fb AGAIN********** (3)
688 Knight Probability in Chessboard Python O(k * n^2) O(n^2) Medium dp,dp basic,AGAIN, M$,Goldman Sachs, google, fb, amazon AGAIN********* (5)
712 Minimum ASCII Delete Sum for Two Strings Python O(m * n) O(n) Medium dp AGAIN (not start)
714 Best Time to Buy and Sell Stock with Transaction Fee Python O(n) O(1) Medium AGAIN, good basic, dp, greedy,fb AGAIN******** (3)
727 Minimum Window Subsequence Java O(n) O(1) Hard dp,google AGAIN (not start)
740 Delete and Earn Python O(n) O(1) Medium AGAIN (not start)
746 Min Cost Climbing Stairs Python O(n) O(1) Easy good dp basic,dp, amazon AGAIN**** (2)
750 Number Of Corner Rectangles Python O(n * m^2) O(n * m) Medium dp,fb AGAIN (3) (not start)
764 Largest Plus Sign Python O(n^2) O(n^2) Medium dp, complex ,fb AGAIN (not start) (2)
788 Rotated Digits Python O(logn) O(logn) Easy Brute Force, Memoization OK*
790 Domino and Tromino Tiling Python O(logn) O(1) Medium Matrix Exponentiation, dp, google AGAIN (not start)
799 Champagne Tower Python O(n^2) O(n) Medium dp AGAIN
801 Minimum Swaps To Make Sequences Increasing Python, Java O(n) O(1) Medium dp, amazon, fb AGAIN***** (not start) (2)
808 Soup Servings Python O(1) O(1) Medium AGAIN (not start)
813 Largest Sum of Averages Python O(k * n^2) O(n) Medium dp, google AGAIN (not start)
823 Binary Trees With Factors Python O(n^2) O(n) Medium dp AGAIN (not start)
837 New 21 Game Python, Java O(n) O(n) Medium dp, trick, math, google AGAIN (2) (not start)
838 Push Dominoes Python O(n) O(n) Medium dp,two pointers,google AGAIN (not start)
877 Stone Game Python O(n^2) O(n) Medium variant of Predict the Winner AGAIN (not start)
926 Flip String to Monotone Increasing Python O(n) O(1) Medium good trick, dp, prefix sum, google, amazon AGAIN********** (4)
931 Minimum Falling Path Sum Python O(n^2) O(1) Medium google, goldman sachs AGAIN (not start)
935 Knight Dialer Python O(logn) O(1) Medium Matrix Exponentiation, google, M$, fb AGAIN (not start)
518 Coin Change 2 Python O(logn) O(1) Medium dp basic,good trick,check # 322 Coin Change,dp, google, fb AGAIN******** (4)
494 Target Sum Python O(logn) O(1) Medium dp basic, dp, fb AGAIN***** (1)
1000 Minimum Cost to Merge Stones Python O(logn) O(1) Medium dp, amazon AGAIN (not start)
1048 Longest String Chain Java O(logn) O(1) Medium dp, google AGAIN (not start)
1143 Longest Common Subsequence Python O(logn) O(1) Medium Curated Top 75, Memoization, dp, amazon, karat AGAIN*** (2) (not start)
1312 Minimum Insertion Steps to Make a String Palindrome Python O(logn) O(1) Hard dp, amazon AGAIN (not start)
1335 Minimum Difficulty of a Job Schedule Python O(logn) O(1) Medium dp, amazon not start
1799 Maximize Score After N Operations Python O(logn) O(1) Medium dp, amazon not start
3196 Maximize Total Cost of Alternating Subarrays Java O(logn) O(1) Medium dp, LC weekly Again

Greedy

# Title Solution Time Space Difficulty Tag, Note Status
011 Container With Most Water Python, Java O(n) O(1) Medium Curated Top 75, good basics, two pointers,fb, amazon OK*** (3) (but again !!)
045 Jump Game II Python, Java O(n) O(1) Medium Greedy, google, apple, fb, tesla, amazon AGAIN******** (4) (MUST)
055 Jump Game Python, Java O(n) O(1) Medium Curated Top 75, good trick, backtrack, Greedy, DP, amazon AGAIN******** (8)
084 Largest Rectangle in Histogram Python, Java O(n) O(1) Hard top 100 like, brute force, divide and conquer, good trick, stack, LC 085, amazon, fb AGAIN**** (1)
122 Best Time to Buy and Sell Stock II Python O(n) O(1) Easy compare with #309 Best Time to Buy and Sell Stock with Cooldown , #714 Best Time to Buy and Sell Stock with Transaction Fee, amazon OK* (2)
134 Gas Station Python, Java O(n) O(1) Medium trick, greedy,amazon AGAIN****** (5)
135 Candy Python, Java O(n) O(1) Hard LC 123, greedy, boundary, array, amazon AGAIN (2)
218 The Skyline Problem Python O(n) O(1) Hard brute force, swipe line, Priority Queue, Union Find, Divide-and-Conquer, apple, microsoft AGAIN (not start)
330 Patching Array Python O(n) O(1) Hard array, greedy,amazon AGAIN (not start)
358 Rearrange String k Distance Apart Python O(n) O(1) Medium heap, greedy, check LC 767 not start
376 Wiggle Subsequence Python O(n) O(1) Medium AGAIN*
392 Is Subsequence Python O(n) O(1) Medium basics OK*
397 Integer Replacement Python O(n) O(1) Medium Recursion basics, Math OK*
402 Remove K Digits Python O(n) O(n) Medium LintCode AGAIN (not start*)
435 Non-overlapping Intervals Python, Java O(nlogn) O(1) Medium Curated Top 75, good trick, 2 pointers, inverval, similiar as #452 Minimum Number of Arrows to Burst Balloons, Line Sweep, google AGAIN************ (8)
452 Minimum Number of Arrows to Burst Balloons Python, Java O(nlogn) O(1) Medium sort, compare i-1 element, overlap, good basic AGAIN***** (3)
455 Assign Cookies Python O(nlogn) O(1) Easy OK*
621 Task Scheduler Python, Java O(n) O(1) Medium trick,array,greedy, fb, amazon AGAIN****** (7)
646 Maximum Length of Pair Chain Python O(nlogn) O(1) Medium good trick, greedy, similar as #435 Non-overlapping Intervals, Line Sweep, amazon OK********** (5) (but again)
649 Dota2 Senate Python O(n) O(n) Medium complex question AGAIN (not start*)
659 Split Array into Consecutive Subsequences Python, Java O(n) O(1) Medium map, pq, greedy, dp, google AGAIN***** (1)
738 Monotone Increasing Digits Python O(1) O(1) Medium good trick, greedy, string, trick, Amazon AGAIN********* (4)
763 Partition Labels Python O(n) O(n) Medium greedy,trick,dict,index,amazon AGAIN******* (5) (AGAIN)
767 Reorganize String Python O(n) O(1) Medium greedy,counter,good trick,amazon,fb AGAIN**************** (7) (MUST)
861 Score After Flipping Matrix Python O(r * c) O(1) Medium AGAIN (not start*)
870 Advantage Shuffle Python O(nlogn) O(n) Medium OK*
881 Boats to Save People Python O(nlogn) O(n) Medium good trick OK*
948 Bag of Tokens Python O(nlogn) O(1) Medium Two Pointers AGAIN (not start)
962 Maximum Width Ramp Python O(n) O(n) Medium Descending Stack AGAIN (not start)
1024 Video Stitching Python Medium Spotify AGAIN (not start)
1102 Path With Maximum Minimum Value Python Medium dfs, dp , greedy, amazon not start
319 Bulb Switcher Python Medium not start
672 Bulb Switcher II Python Medium not start
1375 Bulb Switcher III Python Medium queue, array, gra* AGAIN*** (1)
1648 Sell Diminishing-Valued Colored Balls Python Medium trick, sorting, heapq, binary search, greedy, amazon AGAIN*** (2) (not start)
1710 Maximum Units on a Truck Python Easy sort, greedy, amazon AGAIN******** (3) (MUST)

Graph

# Title Solution Time Space Difficulty Status Note
269 Alien Dictionary Python, Java Hard Curated Top 75, dfs, bfs, Topologicals sort, fb, google, m$, airbnb, uber, amazon AGAIN******** (4) (not start)
323 Number of Connected Components in an Undirected Graph Python , Java O(n) O(n) Medium Curated Top 75, LC 547, 🔒 , dfs, Union Find, graph, linkedin, amazon, fb, google, m$, linkedin AGAIN************** (5) (MUST)
959 Regions Cut By Slashes Python O(n^2) O(n^2) Medium Union Find
1135 Connecting Cities With Minimum Cost Python O(n^2) O(n^2) Medium union find, Kruskal, prime, graph, amazon AGAIN (not start)

Geometry

# Title Solution Time Space Difficulty Status Note
892 Surface Area of 3D Shapes C++ Python O(n^2) O(1) Easy
0587 Erect the Fence Python O(nlogn) O(n) Hard complex, Convex Hull, Monotone Chain , amazon
0892 Surface Area of 3D Shapes

Design

# Title Solution Time Space Difficulty Tag Note
146 LRU Cache Python, Java O(1) O(k) Medium good basic, LRU, Least Recently Used, Double Linkedlist, LinkedHashMap, OrderedDict, priority queue, amazon AGAIN****** (4)
225 Implement Stack using Queues Python, Java push: O(n), pop: O(1), top: O(1) O(n) Easy AGAIN** (1)
284 Peeking Iterator C++ Python O(1) O(1) Medium good basic, google, apple not start*** (1)
348 Design Tic-Tac-Toe Python O(1) O(n^2) Medium matrix, array, 🔒, google, fb, amazon AGAIN****** (5)
353 Design Snake Game Python, Java O(1) O(s) Medium good trick, Deque, 🔒, amazon, google, square, m$ AGAIN*** (1)
355 Design Twitter Python, Java O(klogu) O(t + f) Medium good trick, data structure, heapq, defaultdict, amazon OK******** (6)
0362 Design Hit Counter C++ Python O(1), amortized O(k) Medium 🔒 Deque
0379 Design Phone Directory C++ Python O(1) O(n) Medium 🔒
0380 Insert Delete GetRandom O(1) Python O(1) O(n) Medium/Hard set, list, dict, amazon,fb OK* (5)
0381 Insert Delete GetRandom O(1) - Duplicates allowed C++ Python O(1) O(n) Hard
432 All O`one Data Structure C++ Python O(1) O(n) Hard
460 LFU Cache Python O(1) O(k) Hard Least Frequently Used (LFU) cache, complex, amazon AGAIN*** (2) (not start)
535 Encode and Decode TinyURL Python O(1) O(n) Medium hash map, "duplicated", "hash map collision" ,UBER, amazon,google ,fb, design OK**** (5)
588 Design In-Memory File System C++ Python ls: O(l + klogk)
mkdir: O(l)
addContentToFile: O(l + c)
readContentFromFile: O(l + c)
O(n + s) Hard dict, a bit complex basic, 🔒, shoptify, amazon AGAIN******* (3)
0604 Design Compressed String Iterator C++ Python O(1) O(1) Easy 🔒
622 Design Circular qeque Python Medium 🔒
631 Design Excel Sum Formula C++ Python set: O((r * c)^2)
get: O(1)
sum: O((r * c)^2)
O(r * c) Hard 🔒
635 Design Log Storage System C++ Python put: O(1)
retrieve: O(n + dlogd)
O(n) Medium 🔒
641 Design Circular Deque Python Medium 🔒
642 Design Search Autocomplete System Python O(p^2) O(p * t + s) Hard 🔒, amazon AGAIN**** (not start) (5)
705 Design HashSet Python Easy
706 Design HashMap Python Easy
0715 Range Module C++ Python add: O(n)
remove: O(n)
query: O(logn)
O(n) Hard
716 Max Stack Python push: O(logn)
pop: O(logn)
popMax: O(logn)
top: O(1)
peekMax: O(1)
O(n) Easy basic, stack, amazon again*
745 Prefix and Suffix Search Python ctor: O(w * l^2)
search : O(p + s)
O(t) Hard Trie, fb Not start* (1) (good basic)
900 RLE Iterator C++ Python, Java O(n) O(1) Medium google, treemap, array AGAIN (not start) (1)
1146 Snapshot Array Java set: O(1)
get: O(logn)
O(n) Medium treeMap, binary search, google AGAIN*** (1)
1166 Design File System C++ Python create: O(n)
get: O(n)
O(n) Medium 🔒, design, google, airbnb, amazon AGAIN***** (1)
1172 Dinner Plate Stacks C++ Python push: O(logn)
pop: O(1), amortized
popAtStack: (logn)
O(n * c) Hard
1188 Design Bounded Blocking Queue Java push: O(logn)
pop: O(1), amortized
popAtStack: (logn)
O(n * c) Medium google, Semaphore AGAIN (not start)
1206 Design Skiplist C++ Python O(logn), on average O(n) Hard
1236 Web Crawler C++ Python O(|V| + |E|) O(|V|) Medium 🔒, BFS, DFS
1244 Design A Leaderboard C++ Python ctor: O(1)
add: O(1)
top: O(n)
reset: O(1)
O(n) Medium
1268 Search Suggestions System Python ctor: O(n * l)
suggest: O(l^2)
O(t) Medium good basic, array, heap, sort, Trie, amazon AGAIN******** (3)
1286 Iterator for Combination C++ Python O(k) O(k) Medium Stack
1429 First Unique Number Python O(k) O(k) Medium good trick, heap, amazon AGAIN*** (not start)
1472 Design Browser History Python O(k) O(k) Medium AGAIN
1500 Design a File Sharing System Python O(k) O(k) Medium design, hashmap AGAIN*** (not start)
1603 Design Parking System Python O(k) O(k) Easy design, amazon , paypal OK
1628 Design an Expression Tree With Evaluate Function Python O(k) O(k) Medium complex, design, amazon AGAIN*** (not start)
1656 Design an Ordered Stream Python O(k) O(k) Easy
1670 Design Front Middle Back Queue Python O(k) O(k) Medium good basic, Design, amazon AGAIN** (1) (not start)
1756 Design Recent Used Queue Python O(k) O(k) Medium design, queue AGAIN
1797 Design Authentication Manager Python O(k) O(k) Medium design, hashmap AGAIN
1976 Number of Ways to Arrive at Destination Python O(k) O(k) Medium

Simulation

# Title Solution Time Space Difficulty Status Note
874 Walking Robot Simulation C++ Python O(n + k) O(k) Easy

Concurrency

# Title Solution Time Space Difficulty Tag Note
1114 Print in Order C++ Python O(n) O(1) Easy
1115 Print FooBar Alternately C++ Python O(n) O(1) Medium
1116 Print Zero Even Odd C++ Python O(n) O(1) Medium
1117 Building H2O C++ Python O(n) O(1) Hard
1188 Design Bounded Blocking Queue C++ Python O(n) O(1) Medium 🔒
1195 Fizz Buzz Multithreaded C++ Python O(n) O(1) Medium
1226 The Dining Philosophers C++ Python O(n) O(1) Medium
1242 Web Crawler Multithreaded C++ Python O(|V| + |E|) O(|V|) Medium 🔒
1279 Traffic Light Controlled Intersection C++ Python O(n) O(1) Easy 🔒

SQL

# Title Solution Time Space Difficulty Tag, Note Status
0175 Combine Two Tables MySQL O(m + n) O(m + n) Easy OK (4)
0176 Second Highest Salary MySQL O(n) O(1) Easy amazon,fb OK (4)
0177 Nth Highest Salary MySQL O(n^2) O(n) Medium MySQL PROCEDURE, SQL FAQ AGAIN*** (3)
0178 Rank Scores MySQL O(n^2) O(n) Medium trick, SQL var, ank, select same table, rank AGAIN****** (7)
0180 Consecutive Numbers MySQL O(n) O(n) Medium SQL var, join same table multi times OK* (3)
0181 Employees Earning More Than Their Managers MySQL O(n^2) O(1) Easy OK
0182 Duplicate Emails MySQL O(n^2) O(n) Easy OK
0183 Customers Who Never Order MySQL O(n^2) O(1) Easy left join OK** (3) (but again)
0184 Department Highest Salary MySQL O(n^2) O(n) Medium trick, where, good basic OK***** (but again) (6)
0185 Department Top Three Salaries MySQL O(n^2) O(n) Hard similiar as # 0177 Nth Highest Salary, good trick, top N in group AGAIN******** (5)
0196 Delete Duplicate Emails MySQL O(n^2) O(n) Easy, delete command AGAIN (2)
0197 Rising Temperature MySQL O(n^2) O(n) Easy OK
0262 Trips and Users MySQL O((t * u) + tlogt) O(t) Hard case condisions OK* (2)
0511 Game Play Analysis I MySQL O(n) O(n) Easy 🔒 OK
0512 Game Play Analysis II MySQL O(n) O(n) Easy 🔒, 2 col where good trick AGAIN**(4)
0534 Game Play Analysis III MySQL O(nlogn) O(n) Medium 🔒, SQL var, tricky, window func AGAIN******** (6)
0550 Game Play Analysis IV MySQL O(n) O(n) Medium case, fraction, join, good basic, where min condition OK*********** (7) (but again)
569 Median Employee Salary MySQL O(n) O(n) Medium medium number AGAIN* (not start)
571 Find Median Given Frequency of Numbers MySQL O(n) O(n) Medium medium number AGAIN** (not start) (2)
577 Employee Bonus MySQL O(n) O(n) Easy OK
578 Get Highest Answer Rate Question MySQL Medium fb, case condition OK* (3)
579 Find Cumulative Salary of an Employee MySQL Hard window function, amazon, good trick OK***** (5)(but again)
580 Count Student Number in Departments MySQL Medium OK*** (2) (but again)
595 Big Countries MySQL Easy OK
597 Friend Requests I: Overall Acceptance Rate MySQL Medium select distinct, ifnull,fb OK*** (7)
601 Human Traffic of Stadium MySQL Hard consecutive nums OK* (1)
602 Friend Requests II: Who Has Most Friend? MySQL Medium union all, fb OK*** (4)
603 Consecutive Available Seats MySQL Medium consecutive nums, good basic, cross join OK***** (3)(but again)
618 Students Report By Geography MySQL Hard sql var AGAIN (not start)
620 Not Boring Movies MySQL Easy OK
626 Exchange Seats MySQL Medium AGAIN (not start)
627 Swap Salary MySQL Easy UPDATE with CASE, good basic OK* (1) (but again)
1045 Customers Who Bought All Products MySQL O(n + k) O(n + k) Medium 🔒, where with count OK*** (4)
1050 Actors and Directors Who Cooperated At Least Three Times MySQL O(n) O(n) Easy 🔒 OK
1068 Product Sales Analysis I MySQL O(m + n) O(m + n) Easy 🔒 OK
1069 Product Sales Analysis II MySQL O(n) O(n) Easy 🔒 OK
1070 Product Sales Analysis III MySQL O(n) O(n) Medium 🔒 OK
1075 Project Employees I MySQL O(m + n) O(m + n) Easy 🔒 OK
1076 Project Employees II MySQL O(n) O(n) Easy 🔒 OK (2)
1077 Project Employees III MySQL O((m + n)^2) O(m + n) Medium 🔒, tricky where OK***** (2) (but again)
1082 Sales Analysis I MySQL O(n) O(n) Easy 🔒, group by only 1 col, good basic OK***** (5) (again)
1083 Sales Analysis II MySQL O(m + n) O(m + n) Easy 🔒, not in OK*** (3) (again)
1084 Sales Analysis III MySQL O(m + n) O(m + n) Easy 🔒 OK** (2)
1097 Game Play Analysis V MySQL O(n^2) O(n) Hard 🔒, good basic,retention, case condition, retention, data_add, left join AGAIN******* (8)
1098 Unpopular Books MySQL O(m + n) O(n) Medium 🔒, where not in OK* (2)
1107 New Users Daily Count MySQL O(n) O(n) Medium 🔒 OK*
1112 Highest Grade For Each Student MySQL O(nlogn) O(n) Medium 🔒, good basic OK** (4)
1113 Reported Posts MySQL O(n) O(n) Easy 🔒 OK
1126 Active Businesses MySQL O(n) O(n) Medium 🔒, good basic AGAIN*** (3)
1127 User Purchase Platform MySQL O(n) O(n) Hard 🔒, complex, union all, case OK**** (6) (but again)
1132 Reported Posts II MySQL O(m + n) O(n) Medium 🔒 OK*** (4)
1141 User Activity for the Past 30 Days I MySQL O(n) O(n) Easy 🔒 AGAIN* (2)
1142 User Activity for the Past 30 Days II MySQL O(n) O(n) Easy 🔒 AGAIN* (1)
1148 Article Views I MySQL O(nlogn) O(n) Easy 🔒 OK
1149 Article Views II MySQL O(nlogn) O(n) Medium 🔒 OK*
1158 Market Analysis I MySQL O(m + n) O(m + n) Medium 🔒, case when ... is not null AGAIN**** (5)
1159 Market Analysis II MySQL O(m + n) O(m + n) Hard 🔒, good trick AGAIN** (3)
1164 Product Price at a Given Date MySQL O(mlogn) O(m) Medium 🔒, good trick, union, case, not in a period AGAIN******** (2)
1173 Immediate Food Delivery I MySQL O(n) O(1) Easy 🔒 OK
1174 Immediate Food Delivery II MySQL O(n) O(m) Medium 🔒 OK**** (3)
1179 Reformat Department Table MySQL O(n) O(n) Easy 🔒 OK
1193 Monthly Transactions I MySQL O(n) O(n) Medium 🔒 OK (2)
1194 Tournament Winners MySQL O(m + n + nlogn) O(m + n) Hard 🔒 AGAIN*
1204 Last Person to Fit in the Elevator MySQL O(nlogn) O(n) Medium 🔒, cumsum, window func, good basic OK****** (3)
1205 Monthly Transactions II MySQL O(n) O(n) Medium 🔒, good trick, union all, case conditions OK*** (3) (but again)
1211 Queries Quality and Percentage MySQL O(n) O(n) Easy OK
1212 Team Scores in Football Tournament MySQL O(nlogn) O(n) Medium good trick OK** (2)
1225 Report Contiguous Dates MySQL O(nlogn) O(n) Hard 🔒 AGAIN* (2) (not start)
1241 Number of Comments per Post MySQL O(n) O(n) Easy 🔒, good basic OK**** (5) (but again)
1251 Average Selling Price MySQL O(n) O(n) Easy 🔒, good basic OK*** (but again) (3)
1264 Page Recommendations MySQL O(m + n) O(m) Medium 🔒 OK** (2)
1270 All People Report to the Given Manager MySQL O(n) O(n) Medium 🔒, good basic OK* (3)
1280 Students and Examinations MySQL O((m * n) * log(m * n)) O(m * n) Easy 🔒 OK (1)
1285 Find the Start and End Number of Continuous Ranges MySQL O(n) O(n) Medium 🔒, variable AGAIN (not start) (1)
1294 Weather Type in Each Country MySQL O(m + n) O(n) Easy 🔒 OK (1)
1303 Find the Team Size MySQL O(n) O(n) Easy 🔒 ok (1)
1308 Running Total for Different Genders MySQL O(nlogn) O(n) Medium 🔒, good basic, union all, window func OK**** (3)
1321 Restaurant Growth MySQL O(n^2) O(n) Medium 🔒, good basic, trick AGAIN***** (3)
1322 Ads Performance MySQL O(nlogn) O(n) Easy 🔒, good basic OK******* (3) (but again)
1327 List the Products Ordered in a Period MySQL O(n) O(n) Easy 🔒 OK
1336 Number of Transactions per Visit MySQL O(m + n) O(m + n) Medium 🔒, complex, variable AGAIN (not start)
1341 Movie Rating MySQL O(nlogn) O(n) Medium 🔒 AGAIN (not start)
1350 Students With Invalid Departments MySQL O(n) O(n) Easy 🔒 OK
1355 Activity Participants MySQL O(n) O(n) Medium 🔒 OK
1364 Number of Trusted Contacts of a Customer MySQL O(n + m + l + nlogn) O(n + m + l) Medium 🔒 OK
1369 Get the Second Most Recent Activity MySQL O(nlogn) O(n) Hard 🔒, union, having OK** (2) (but again)
1378 Replace Employee ID With The Unique Identifier MySQL O(n) O(n) Easy 🔒 OK
1384 Total Sales Amount by Year MySQL O(nlogn) O(n) Hard 🔒, complex OK*
1393 Capital Gain/Loss MySQL O(n) O(n) Medium 🔒 OK
1398 Customers Who Bought Products A and B but Not C MySQL O(m + n) O(m + n) Medium 🔒 OK
1407 Top Travellers MySQL O(m + nlogn) O(m + n) Easy 🔒, ifnull OK*
1412 Find the Quiet Students in All Exams MySQL O(m + nlogn) O(m + n) Hard 🔒, good trick, not in, inner join on multiple cols OK**** (3) (but again)
1421 NPV Queries MySQL O(n) O(n) Medium 🔒 OK
1435 Create a Session Bar Chart MySQL O(n) O(1) Easy 🔒 OK
1440 Evaluate Boolean Expression MySQL O(n) O(n) Medium 🔒 OK
1445 Apples & Oranges MySQL O(n) O(n) Medium 🔒 OK
1454 Active Users MySQL O(nlogn) O(n) Medium 🔒, good basic, window func AGAIN*** (2)
1459 Rectangles Area MySQL O(n^2) O(n^2) Medium 🔒 OK*
1468 Calculate Salaries MySQL O(m + n) O(m + n) Easy 🔒 OK*
1479 Sales by Day of the Week MySQL O(m + n) O(n) Hard 🔒, case, DAYOFWEEK OK
1484 Group Sold Products By The Date MySQL O(nlogn) O(n) Easy 🔒, GROUP_CONCAT OK*
1495 Friendly Movies Streamed Last Month MySQL O(n) O(n) Easy 🔒 OK
1501 Countries You Can Safely Invest In MySQL O(n) O(n) Medium 🔒,good trick, group avg, global avg, SUBSTRING, inner join on or conditions OK****** (4)
1511 Customer Order Frequency MySQL O(n) O(n) Easy 🔒, having, like OK* (1)
1517 Find Users With Valid E-Mails MySQL O(n) O(n) Easy 🔒, regular expression AGAIN
1527 Patients With a Condition MySQL O(n) O(n) Easy 🔒 OK
1532 The Most Recent Three Orders MySQL O(nlogn) O(n) Medium 🔒, window func, good basic OK** (2) (but again)
1543 Fix Product Name Format MySQL O(nlogn) O(n) Easy 🔒, trim OK
1549 The Most Recent Orders for Each Product MySQL O(nlogn) O(n) Medium 🔒, max day per id, good basic OK* (again)
1555 Bank Account Summary MySQL O(m + n) O(m + n) Medium 🔒, union all, good trick OK**** (2)(but again)
1565 Unique Orders and Customers Per Month MySQL O(n) O(n) Easy 🔒 OK
1571 Warehouse Manager MySQL O(n) O(n) Medium 🔒 OK* (1)
1581 Customer Who Visited but Did Not Make Any Transactions MySQL O(n) O(n) Easy 🔒, left join, good basic OK** (2)(but again)
1587 Bank Account Summary II MySQL O(m + n) O(m + n) Easy 🔒 OK
1596 The Most Frequently Ordered Products for Each Customer MySQL O(n) O(n) Medium 🔒, good trick, rank() ORDER BY count, get max in each group OK********* (3)(but again)
1607 Sellers With No Sales MySQL O(nlogm) O(n + m) Medium 🔒 OK
1613 Find the Missing IDs MySQL O(n^2) O(n) Medium 🔒, RECURSIVE CTE, good trick AGAIN*** (2)
1623 All Valid Triplets That Can Represent a Country MySQL O(n^3) O(n^3) Easy 🔒, <> AGAIN* (not start)
1633 Percentage of Users Attended a Contest MySQL O(m + nlogn) O(n) Easy 🔒 OK
1635 Hopper Company Queries I MySQL O(d + r + tlogt) O(d + r + t) Hard 🔒, complex AGAIN (not start)
1645 Hopper Company Queries II MySQL O(d + r + tlogt) O(d + r + t) Hard 🔒, complex AGAIN (not start)
1651 Hopper Company Queries III MySQL O(d + r + tlogt) O(d + r + t) Hard 🔒, complex AGAIN (not start)
1661 Average Time of Process per Machine MySQL O(n) O(n) Easy 🔒, good basic OK* (1)
1667 Fix Names in a Table MySQL O(nlogn) O(n) Easy 🔒, concat, sub-string OK (1)
1677 Product's Worth Over Invoices MySQL O(nlogn) O(n) Easy 🔒 OK
1683 Invalid Tweets MySQL O(n) O(n) Easy 🔒 OK
1693 Daily Leads and Partners MySQL O(n) O(n) Easy 🔒 OK
1699 Number of Calls Between Two Persons MySQL O(n) O(n) Medium 🔒, cte, union all OK* (1)(but again)
1709 Biggest Window Between Visits MySQL O(nlogn) O(n) Medium 🔒, window func, datediff, coalesce, good trick AGAIN***** (2)
1715 Count Apples and Oranges MySQL O(n) O(n) Medium 🔒, ifnull OK (2)
1729 Find Followers Count MySQL O(nlogn) O(n) Easy 🔒 OK
1731 The Number of Employees Which Report to Each Employee MySQL O(nlogn) O(n) Easy 🔒 OK
1741 Find Total Time Spent by Each Employee MySQL O(nlogn) O(n) Easy 🔒 OK
1747 Leetflex Banned Accounts MySQL O(n^2) O(n) Medium 🔒 OK (2) (but again)
1757 Recyclable and Low Fat Products MySQL O(n) O(n) Easy 🔒 OK
1767 Find the Subtasks That Did Not Execute MySQL O(n * c) O(n * c) Hard 🔒, RECURSIVE CTE AGAIN (not start)
1777 Product's Price for Each Store MySQL O(n) O(n) Easy 🔒 OK (2)
1783 Grand Slam Titles MySQL O(n) O(n) Medium 🔒, union all, good basic OK* (1) (but again)
1789 Primary Department for Each Employee MySQL O(n) O(n) Easy 🔒, where id in OK (1) (but again)
1795 Rearrange Products Table MySQL O(n) O(n) Easy 🔒, union all, good basic OK****** (2)
1809 Ad-Free Sessions MySQL O(n) O(n) Easy 🔒, left join where col is null OK**** (3)(but again)
1811 Find Interview Candidates MySQL O(nlogn) O(n) Medium 🔒, union all, cte, where, good basic AGAIN* (2)
1821 Find Customers With Positive Revenue this Year MySQL O(n) O(n) Easy 🔒 OK
1831 Maximum Transaction Each Day MySQL O(nlogn) O(n) Medium 🔒, rank(), where on 2 attr, good basic AGAIN**** (2)
1841 League Statistics MySQL O(nlogn) O(n) Medium 🔒, case, complex AGAIN* (2)
1843 Suspicious Bank Accounts MySQL O(nlogn) O(n) Medium 🔒, good trick, window func OK** (2) (but AGAIN)
1853 Convert Date Format MySQL O(n) O(n) Easy 🔒 OK
1867 Orders With Maximum Quantity Above Average MySQL O(n) O(n) Easy 🔒 OK (1)
1873 Calculate Special Bonus MySQL O(n) O(n) Easy 🔒, left, odd num OK (2)
1875 Group Employees of the Same Salary MySQL O(nlogn) O(n) Medium 🔒, complex, good basic AGAIN* (1)
1890 The Latest Login in 2020 MySQL O(n) O(n) Easy 🔒 OK
1892 Page Recommendations II MySQL O(n * m) O(n * m) Hard 🔒 AGAIN*** (1) (not start)
1907 Count Salary Categories MySQL O(n) O(n) Medium 🔒, union all OK* (1)
1917 Leetcodify Friends Recommendations MySQL O(n^2) O(n^2) Hard 🔒, NOT EXISTS AGAIN*** (2)
1919 Leetcodify Similar Friends MySQL O(n * l) O(n * l) Hard 🔒 AGAIN* (not start)
1934 Confirmation Rate MySQL O(n + m) O(n + m) Medium 🔒, good basic OK* (1) (but again)
1939 Users That Actively Request Confirmation Messages MySQL O(nlogn) O(n) Easy 🔒, TIMESTAMPDIFF, good basic OK*** (2) (but again)
1949 Strong Friendship MySQL O(n^3) O(n^2) Medium 🔒 good basic, where in 2 cols
1951 All the Pairs With the Maximum Number of Common Followers MySQL O(n^3) O(n^2) Medium 🔒, good trick AGAIN* (2)
1965 Employees With Missing Information MySQL O(nlogn) O(n) Easy 🔒, good basic OK* (1) (but again)
1972 First and Last Call On the Same Day MySQL O(n) O(n) Hard 🔒, rank, union all, amazon AGAIN** (2)
1978 Employees Whose Manager Left the Company MySQL O(nlogn) O(n) Easy 🔒 OK (1)
1988 Find Cutoff Score for Each School MySQL O(n * m) O(n * m) Medium 🔒, no ref AGAIN (not start)
1990 Count the Number of Experiments MySQL O(n) O(n) Easy 🔒, cross join AGAIN* (1)
2004 The Number of Seniors and Juniors to Join the Company MySQL O(nlogn) O(n) Hard 🔒, not ref AGAIN (not start)

Shell Script

# Title Solution Time Space Difficulty Tag Note
0192 Word Frequency Shell O(n) O(k) Medium
0193 Valid Phone Numbers Shell O(n) O(1) Easy
0194 Transpose File Shell O(n^2) O(n^2) Medium
0195 Tenth Line Shell O(n) O(1) Easy