- Algorithm
- Data Structure
- System design
- Case Study
-
Resource.md -
Resource
for coding interview (keep updating) -
ref.md - Leetcode ref
-
MindMapCodeInterview - Mind map for coding interview
-
CodeInterviewCheatsheet - Coding interview cheetsheet
-
repl.it - Coding online!
-
Visualization
- visualgo - DFS / BFS - DFS, BFS visualization
- visualgo - linkedlist - Linkedlist visualization
- visualgo - BST - binary search tree visualization
- toptal-sorting-algorithms- sorting algorithms online
-
How to: Work at Google โ Example Coding/Engineering Interview
-
bit_manipulation.md - Bit Manipulation Cheet Sheet
-
Py TimeComplexity - Python TimeComplexity doc
-
Py data model - Python data model doc
-
pgexercises - Postgre exercises
-
SQL
- SQL exercises - w3resource SQL exercises
- SQL tutorial - mode.com sql tutorial
- SQL zoo - SQL test
- 10 SQL Tricks : 10 SQL Tricks That You Didnโt Think Were Possible
- Zachary Thomas' SQL Questions -- The Best Medium-Hard Data Analyst SQL Interview Questions
- Select * SQL
- LinkedIn Learning
- Window Functions
- HackerRank
- W3 Schools
- CodeAcademy
- SQL Bolt
- self-joins-calculate-retention-churn-and-reactivation-metrics
- Prod metric design
-
LC Pattern
- LC pattern @ blind : Curated-List-of-Top-100-LeetCode-Questions-to-Save-Your-Time
- Blind Curated 75
- LC Algorithm Problem Classification
- fucking-algorithm
- cheatsheet-leetcode-a4
- 14-patterns-to-ace-any-coding-interview-question
- grokking-the-coding-interview
-
LC problems
-
System design
-
Tools
- Bit Manipulation
- Array
- String
- Linked List
- Stack
- Queue
- Heap
- Tree
- Hash Table
- Math
- Two Pointers
- Sort
- Recursion
- Binary Search
- Binary Search Tree
- Breadth-First Search
- Depth-First Search
- Backtracking
- Dynamic Programming
- Greedy
- Graph
- Geometry
- Simulation
- Design
- Concurrency
# | Title | Solution | Use case | Comment | Status |
---|---|---|---|---|---|
Queue | Python , JS | AGAIN* | |||
Stack | Python , JS stack (via linkedlist), JS - stack (via array) | OK | |||
LinkedList | Python, JS | OK** | |||
Doubly LinkedList | Python, JS | AGAIN | |||
Tree | Python | AGAIN** | |||
Trie | Python | AGAIN | |||
Heap | Python , Java | AGAIN | |||
Array | Python | AGAIN* | |||
Graph | Python , JS. Java-graph, Java-graph-client | OK*** | |||
Binary search Tree (BST) | Python, JS, Scala, Java | AGAIN | |||
Hash table | Python, JS | usually for improving time complexity B(O) via extra space complexity (time-space tradeoff) |
good basic |
AGAIN**** | |
DirectedEdge | Java | AGAIN |
# | Title | Solution | Use case | Comment | Status |
---|---|---|---|---|---|
Binary search | Python | 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 |
AGAIN | |
Bucket sort | Python | AGAIN | |||
Quick sort | Python | AGAIN*** | |||
Heap sort | Python | AGAIN** | |||
Merge sort | Python, JS, Java, SQL | OK* (2) | |||
Pancake sort | Python | AGAIN | |||
Selection sort | Python, JS | AGAIN | |||
Topological sort | Python | Redraw DAG so all edges point upwards (DAG : directed acyclic graph) |
AGAIN | ||
md5 | Python | AGAIN | |||
Union Find | Python union find, Python union find check cyclic | AGAIN | |||
Dynamic programming | JS demo 1, fibonacci_dp JS | AGAIN | |||
Dijkstra algorithm | Python,Java | AGAIN*** | |||
Quick Find | Python, Java | init : O(N), union : O(N), find : O(1) | simple, but slow | AGAIN | |
Quick Union | Java | 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 |
# | Title | Solution | Time | Space | Difficulty | Note | Status |
---|---|---|---|---|---|---|---|
015 | 3 Sum | Python | O(n^2) | O(1) | Medium | check with # 001 Two Sum , #018 4 sum , Two Pointers , good basic ,amazon ,fb |
OK******* (6) |
016 | 3 Sum Closest | Python | O(n^2) | O(1) | Medium | Two Pointers , basic , good trick ,3 sum ,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***** (3) |
026 | Remove Duplicates from Sorted Array | Python, Scala | O(n) | O(1) | Easy | Two Pointers , basic , good trick ,M$ ,fb |
AGAIN*********** (6) |
027 | Remove Element | Python, Scala | O(n) | O(1) | Easy | basic , amazon |
OK* (2) |
031 | Next Permutation | Python, Scala | O(n) | O(1) | Medium | good TRICK ,, google ,amazon , fb |
AGAIN******** (5) (not start) |
048 | Rotate Image | Python | O(n^2) | O(1) | Medium | trick , basic , transpose matrix , amazon , apple |
OK** (2) |
054 | Spiral Matrix | Python | O(m * n) | O(1) | Medium | matrix,amazon |
AGAIN** (2) |
057 | Insert Interval | Python | Medium | good basic, blind LC pattern, 056 Merge Intervals |
OK******** (3) (again!) | ||
059 | Spiral Matrix II | Python | O(n^2) | O(1) | Medium | check # 054 Spiral Matrix , amazon |
AGAIN** (2) |
066 | Plus One | Python | O(n) | O(1) | Easy | basic , digit , google |
OK** (2) |
073 | Set Matrix Zeroes | Python | O(m * n) | O(1) | Medium | matrix , amazon |
OK* (4) |
080 | Remove Duplicates from Sorted Array II | Python | O(n) | O(1) | Medium | two pointers ,AGAIN, basic , trick , fb , #26 Remove Duplicates from Sorted Array |
AGAIN********* (4) |
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 | O(n) | O(1) | Easy | dp ,basic ,greedy ,UBER , M$ , amazon , fb |
OK**** (5) (but again) |
157 | Read N Characters Given Read4 | Python | O(n) | O(1) | Easy | ๐, google , amazon , fb |
AGAIN**** (2) |
163 | Missing Ranges | Python | O(n) | O(1) | Medium | two pointer, ๐, google , amazon |
AGAIN******* (3) |
169 | Majority Element | Python | O(n) | O(1) | Easy | amazon |
OK* |
189 | Rotate Array | Python | O(n) | O(1) | Medium | array, k % len(nums), good basic, amazon |
OK* (5) |
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 | O(n) ~ O(n^2) | O(1) | Medium | EPI, quick sort , bubble sort, sort, amazon ,fb |
OK* (2) |
228 | Summary Ranges | Python | O(n) | O(1) | Medium | check # 163 Missing Ranges , basic , array, google |
OK*** (3) |
229 | Majority Element II | Python | O(n) | O(1) | Medium | OK | |
238 | Product of Array Except Self | Python | O(n) | O(1) | Medium | array, LintCode, good trick , Apple , M$ , amazon , fb |
OK******* (but again)(5) |
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***** (6) (but again) |
243 | Shortest Word Distance | Python | 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 | ๐, basic , trick , queue , check# 341 Flatten Nested List Iterator , google , airbnb , twitter , amazon |
AGAIN****** (3) |
277 | Find the Celebrity | Python | O(n) | O(1) | Medium | ๐,rool , fb , trick |
OK****** (4) |
287 | Find the Duplicate Number | Python | Medium | good trick,binary search, cycle linked list, check # 142 Linked List Cycle II , amazon |
AGAIN**** (not start) | ||
289 | Game of Life | Python | O(m * n) | O(1) | Medium | simultaneous,matrix,complex , google , amazon |
AGAIN*** (3) |
293 | Flip Game | Python | O(n * (c+1)) | O(1) | Easy | ๐, basic |
AGAIN* |
311 | Sparse Matrix Multiplication | Python | O(m * n * l) | O(m * l) | Medium | ๐, matrix, basic , fb |
OK** (2) |
334 | Increasing Triplet Subsequence | Python | O(n) | O(1) | Medium | AGAIN, check # 300 Longest Increasing Subsequence , trick , fb , variables |
OK***** (but again) (4) |
370 | Range Addition | Python | O(k + n) | O(1) | Medium | ๐, check # 598 Range Addition II |
AGAIN (not start) |
384 | Shuffle an Array | Python | O(n) | O(n) | Medium | EPI, trick |
OK* |
396 | Rotate Function | Python | O(n) | O(1) | Medium | 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 | AGAIN (not start) | |
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 , AGAIN, reversed, str -> list,string + pointers , fb |
AGAIN****** (4) |
674 | Longest Continuous Increasing Subsequence | Python | 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 | O(nlogn) | O(n) | Medium | python class |
AGAIN* (not start) |
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 | O(n + w) | O(1) | Medium | trick |
AGAIN* (not start) |
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 | complex |
AGAIN (not start) |
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 | O(n) | O(n) | Medium | basic , trick |
AGAIN (not start) |
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 | O(n) | O(n) | Medium | Union Find , trick |
AGAIN (not start) |
949 | Largest Time for Given Digits | Python | O(1) | O(1) | Easy | OK* | |
950 | Reveal Cards In Increasing Order | Python | O(n) | O(n) | Medium | AGAIN (not start) | |
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 | |
004 | Median of Two Sorted Arrays | O(n) | O(1) | Hard | fb , amazon |
||
010 | Regular Expression Matching | O(n) | O(1) | Hard | fb |
||
056 | Merge Intervals | Python | O(n) | O(1) | Medium | good trick ,057 Insert Interval, twitter ,M$ ,UBER ,google ,amazon ,fb |
AGAIN********* (5) |
759 | Employee Free Time | Python | O(n) | O(1) | Hard | scanning line, intervals, amazon |
not start |
1014 | Best Sightseeing Pair | Python | Medium | dp, array, good basic, Spotify | AGAIN (not start) | ||
1041 | Robot Bounded In Circle | Python | Medium | amazon |
AGAIN (not start) |
# | 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 | O(n) | O(1) | Medium | good trick , hash table ,sliding window, apple ,amazon ,fb |
AGAIN**************** (7) (but AGAIN) |
036 | Valid Sudoku | Python | O(9^2) | O(9) | Medium | UBER , apple , amazon |
OK** (2) (again) |
049 | Group Anagrams | Python, Scala | O(n * glogg) | O(n) | Medium | 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 | O(k) | O(k) | Easy | twitter ,airbnb , UBER |
AGAIN** (3) |
204 | Count Primes | Python | O(n) | O(n) | Medium | good trick , cache, dict, set, M$ , amazon |
AGAIN******** (5) |
205 | Isomorphic Strings | Python | O(n) | O(1) | Easy | basic , trick , bloomberg |
AGAIN** |
217 | Contains Duplicate | Python | O(n) | O(n) | Easy | 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 | O(n) | O(1) | Easy | ๐, google , fb |
OK* (4) |
249 | Group Shifted Strings | Python | O(nlogn) | O(n) | Easy | ๐,apple , UBER , google |
AGAIN* (4) (not start) |
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 |
OK**** (5) |
325 | Maximum Size Subarray Sum Equals k | Python | O(n) | O(n) | Medium | ๐, basic , good trick , dict , fb |
AGAIN********** (5) |
356 | Line Reflection | Python | O(n) | O(n) | Medium | ๐, Hash, Two Pointers,math ,google |
AGAIN (not start) |
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**** (2) |
409 | Longest Palindrome | Python | O(n) | O(1) | Easy | OK* | |
424 | Longest Repeating Character Replacement | Python | O(n) | O(1) | Medium | silding window , two pointers , good trick , LC blind pattern |
AGAIN********* (6) |
438 | Find All Anagrams in a String | Python | O(n) | O(1) | Medium | trick , AGAIN , sliding window ,acc Counter ,amazon ,fb |
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** |
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 |
AGAIN************** (8) (MUST) |
525 | Contiguous Array | python | O(n) | O(n) | Medium | sub-array sum, good basic , array , hashmap , cache , AGAIN , fb , amazon |
AGAIN**************** (9) (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 |
OK***** (but again)(5) |
560 | Subarray Sum Equals K | Python | O(n) | O(n) | Medium | must check ,check # 523 Continuous Subarray Sum ,basic , substring ,good trick ,google ,fb |
AGAIN************ (5) |
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* |
721 | Accounts Merge | Python | O(nlogn) | O(n) | Medium | Union Find ,path compression , complex , fb |
AGAIN** (4) (not start) |
734 | Sentence Similarity | Python | O(n + p) | O(p) | Easy | good basic, graph, hash table ,collections.defaultdict(set) ,google |
OK*** (3) |
737 | Sentence Similarity II | Python | O(n + p) | O(p) | Medium | trickm, DFS, Union Find, complex ,check # 734 Sentence Similarity , google |
AGAIN** (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) |
463 | Island Perimeter | Python | O(n) | O(k) | Medium | basic ,hash table , google , fb |
OK** (1) |
657 | Robot Return to Origin | Python | Easy | amazon |
OK (2) | ||
1010 | Pairs of Songs With Total Durations Divisible by 60 | Python | Medium | good basicm dict, array, amazon |
AGAIN****** (2) | ||
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) |
# | Title | Solution | Time | Space | Difficulty | Note | Status |
---|---|---|---|---|---|---|---|
002 | Add Two Numbers | Python | O(n) | O(1) | Medium | check # 445 Add Two Numbers II , basic , linked list , airbnb , amazon , fb |
OK**** (5) (but again) |
021 | Merge Two Sorted Lists | Python | O(n) | O(1) | Easy | UBER , amazon , apple , fb |
OK******** (5(but again) |
024 | Swap Nodes in Pairs | Python | O(n) | O(1) | Easy | GOOD basic , good linked list basic ,UBER ,amazon , fb |
AGAIN********** (4) |
025 | Reverse Nodes in k-Group | Python | O(n) | O(1) | Hard | good trick, reverse linkedlist, reverse K linkedlist | AGAIN*** (2) (not start) |
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 | O(n) | O(1) | Easy | basic |
OK* |
092 | Reverse Linked List II | Python | O(n) | O(1) | Medium | chck # 206 Reverse Linked List , good trick |
AGAIN***** (4) (not start) |
138 | Copy List with Random Pointer | Python | O(n) | O(1) | Medium | trick, linked list,hash table ,UBER , M$ , amazon , fb |
AGAIN***** (6) |
160 | Intersection of Two Linked Lists | Python | O(m + n) | O(1) | Easy | basic, airbnb , amazon ,fb |
OK******* (6) (again!) |
203 | Remove Linked List Elements | Python | O(n) | O(1) | Easy | linked list basic,amazon |
AGAIN** (2) |
206 | Reverse Linked List | Python | O(n) | O(1) | Easy | good basic ,amazon ,fb |
OK*********** (8) (but AGAIN) |
234 | Palindrome Linked List | Python | 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 | Medium | good trick ,doubly linked list ,AGAIN ,dfs , fb |
AGAIN********* (4) | ||
708 | Insert into a Cyclic Sorted List | python | O(n) | O(h) | Medium | AGAIN ,cyclic linked list ,good trick , google , amazon , fb |
AGAIN******** (4) |
023 | Merge k sorted lists | python | O(n) | O(h) | Hard | linked list, check #21 Merge Two Sorted Lists , amazon |
OK**** (2) (but again !!!) |
# | Title | Solution | Time | Space | Difficulty | Note | Status |
---|---|---|---|---|---|---|---|
020 | Valid Parentheses | Python | O(n) | O(n) | Easy | good basic ,fb , amazon |
OK** (5) |
071 | Simplify Path | Python | O(n) | O(n) | Medium | basic , stack , amazon ,fb |
OK* (4) |
101 | Symmetric Tree | Python | O(n) | O(h) | Easy | good basic ,bfs , dfs , linkedin , M$ ,amazon , fb |
AGAIN** (3) |
150 | Evaluate Reverse Polish Notation | Python | O(n) | O(n) | Medium | stack, good trick,amazon |
OK**** (3) |
155 | Min Stack | Python | O(n) | O(1) | Easy | basic,stack,data structure, amazon |
OK** (3) |
173 | Binary Search Tree Iterator | python | O(1) | O(h) | Medium | good basic ,M$ , linkedin , google ,amazon ,fb |
OK*** (3) |
224 | Basic Calculator | python | O(n) | O(n) | Hard | basic ,trick ,stack , check LC 227 |
AGAIN*** (2) |
227 | Basic Calculator II | python | O(n) | O(n) | Medium | check LC 224, good trick ,stack ,airbnb ,fb |
AGAIN********** (4) |
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 | ๐ Iterator, good basic ,amazon ,fb*** |
AGAIN**** (5) |
385 | Mini Parser | python | O(n) | O(h) | Medium | AGAIN | |
394 | Decode String | python | O(n) | O(h) | Medium | stack, good basic!!!!, amazon , google |
AGAIN************ (4) |
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 | O(n) | O(n) | Easy | stack, LC 739, LC 503, LC 406 | OK*** (2) (but again) |
503 | Next Greater Element II | python | O(n) | O(n) | Medium | LC 739, LC 503, LC 406 | AGAIN*** (3) (not start) |
636 | Exclusive Time of Functions | python | O(n) | O(n) | Medium | trick ,AGAIN ,stack ,UBER , fb |
AGAIN********** (4) |
682 | Baseball Game | python | O(n) | O(n) | Easy | good basic, stack,amazon |
OK* (3) |
735 | Asteroid Collision | python | O(n) | O(n) | Medium | AGAIN | |
739 | Daily Temperatures | python | O(n) | O(n) | Medium | LC 739, LC 503, LC 406, AGAIN, stack, good trick,amazon |
AGAIN********* (5) |
853 | Car Fleet | python | O(nlogn) | O(n) | Medium | AGAIN (not start) | |
856 | Score of Parentheses | python | O(n) | O(1) | Medium | AGAIN (not start) | |
872 | Leaf-Similar Trees | python | O(n) | O(h) | Easy | AGAIN* | |
901 | Online Stock Span | python | O(n) | O(n) | Medium | AGAIN (not start) | |
946 | Validate Stack Sequences | python | O(n) | O(n) | Medium | AGAIN |
# | Title | Solution | Time | Space | Difficulty | Note | Status |
---|---|---|---|---|---|---|---|
094 | Binary Tree Inorder Traversal | python | O(n) | O(1) | Medium | good basic ,Morris Traversal , M$ , fb |
AGAIN**** (3) |
124 | Binary Tree Maximum Path Sum | python | O(n) | O(1) | Hard | blind LC top 100 pattern | AGAIN**** (1) (not start) |
144 | Binary Tree Preorder Traversal | python | O(n) | O(1) | Medium | Morris Traversal |
AGAIN |
208 | Implement Trie (Prefix Tree) | python | O(n) | O(1) | Medium | dict tree, trie, amazon ,fb |
AGAIN*********** (6) |
211 | Add and Search Word - Data structure design | python | O(min(n, h)) | O(min(n, h)) | Medium | Trie , DFS , do # 208 first ,amazon ,fb |
AGAIN***** (5) |
226 | Invert Binary Tree | python | O(n) | O(h), O(w) | Easy | good basic | OK******* (4) (but 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 | O(n) | O(h) | Medium | good basic, dfs, bfs, tree, amazon |
OK********* (6) (but again!) |
543 | Diameter of Binary Tree | python | O(n) | O(h) | Easy | trick ,google ,amazon ,fb |
AGAIN**** (2) |
545 | Boundary of Binary Tree | python | O(n) | O(h) | Medium | recursive, dfs, tree boundary, tree,๐, good trick , amazon |
AGAIN****** (5) |
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 | O(m * n) | O(h) | Easy | LC 100, tree,good basic, dfs, bfs | amazon ,fb |
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 | O(n) | O(h) | Easy | tree, dfs, bfs, good basic , amazon |
OK******* (4) (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 | O(n) | O(h) | Easy | bfs , dfs , good basic , fb |
OK* (3) |
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 | O(n) | O(h) | Easy | Two Pointers,2 sum ,bfs , dfs ,amazon ,fb |
OK*** (3) |
654 | Maximum Binary Tree | python | 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******** (7) |
677 | Map Sum Pairs | python | O(n) | O(t) | Medium | Trie, trick , hard |
AGAIN* (2) (not start) |
684 | Redundant Connection | python | O(n) | O(n) | Medium | Union Find, trick , basic |
AGAIN** (2) (not start) |
687 | Longest Univalue Path | python | O(n) | O(h) | Easy | basic , dfs, tree, trick , google |
AGAIN** (3) |
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 | DFS + BFS, trick , hard , amazon |
AGAIN*** (3) (not start*) |
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 | O(n) | O(h) | Medium | DFS , stack , trick |
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 | O(n) | O(h) | Medium | DFS | AGAIN* (2) |
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) | ||
297 | Serialize and Deserialize Binary Tree | python | Hard | tree, BFS, DFS, dequeue, check #449 Serialize and Deserialize BST ,amazon |
AGAIN**** (1) | ||
701 | Insert into a Binary Search Tree | python | Medium | good basic, BST, tree, BFS, DFS | OK*** (2) |
# | Title | Solution | Time | Space | Difficulty | Note | Status |
---|---|---|---|---|---|---|---|
264 | Ugly Number II | python | O(n) | O(1) | Medium | LC 313, CTCI, LintCode , DP, Heap | AGAIN*** (3) |
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 | O(nlogn) | O(n) | Medium | OK* | |
855 | Exam Room | python | seat: O(logn) leave: O(logn) |
O(n) | Medium | BST, Hash, trick |
AGAIN* (2) (not start) |
295 | Find Median from Data Stream | python | Hard | priority queue, trick ,heap, stream, amazon |
AGAIN****** (6) | ||
703 | Kth Largest Element in a Stream | python | Easy | heap, stream, amazon |
AGAIN***** (3) | ||
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) |
# | 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 | O(1) | O(1) | Easy | AGAIN (not stary) | |
191 | Number of 1 Bits | Python | O(1) | O(1) | Easy | 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 | Bit Manipulation ,amazon |
OK* (2) |
260 | Single Number III | Python | O(n) | O(1) | Medium | xor , ^= , ^ |
AGAIN* |
268 | Missing Number | Python | O(n) | O(1) | Medium | 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 | O(1) | O(1) | Easy | good basic , fb |
AGAIN********* (4)(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*) (4) |
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) |
# | Title | Solution | Time | Space | Difficulty | Status, Note | Status |
---|---|---|---|---|---|---|---|
005 | Longest Palindromic Substring | python | O(n) | O(n) | Medium | good trick, 2 pointer, Manacher's Algorithm , DP , UBER , amazon , fb |
AGAIN********** (6) |
006 | ZigZag Conversion | python | O(n) | O(1) | Easy | AGAIN (not start) | |
008 | String to Integer (atoi) | python | O(n) | O(1) | Medium | string op, regular expression ,UBER , amazon , fb |
OK***** (5) |
014 | Longest Common Prefix | python | O(n * k) | O(1) | Easy | good basic |
OK* |
028 | Implement strStr() | python | O(n + k) | O(k) | Easy | KMP Algorithm , fb |
OK (3) |
038 | Count and Say | python | O(n * 2^n) | O(2^n) | Easy | recursion , iteration , basic, fb |
AGAIN*********** (5) |
043 | Multiply Strings | python | 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 | O(n) | O(1) | Easy | good basic , fb , amazon |
OK* (5) (but again) |
076 | Minimum Window Substring | python | Hard | blind LC pattern |
AGAIN* (2) (not start) | ||
125 | Valid Palindrome | python | O(n) | O(1) | Easy | 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 | ๐, recursion, string, , fb |
AGAIN****** (4)(AGAIN) |
165 | Compare Version Numbers | python | O(n) | O(1) | Easy | good basic, string,amazon |
AGAIN* (2) |
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 | O(n) | O(1) | Easy | LintCode,amazon ,fb |
OK |
271 | Encode and Decode Strings | python | O(n) | O(1) | Medium | decode-encode, design, check # 394 Decode String ,๐, google |
AGAIN** (2) |
306 | Addictive Number | python | O(n^3) | O(n) | Medium | AGAIN (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 | basic , string add , Airbnb , google , fb |
OK** (3) |
434 | Number of Segments in a String | python | O(n) | O(1) | Easy | OK | |
443 | String Compression | python | O(n) | O(1) | Easy | basics |
AGAIN** |
459 | Repeated Substring Pattern | python | O(n) | O(n) | Easy | good basic, string, KMP Algorithm , amazon |
OK* (5) |
468 | Validate IP Address | python | O(1) | O(1) | Medium | ip basic ,string ,twitter , fb , amazon |
AGAIN****** (5) |
482 | License Key Formatting | python | O(n) | O(1) | Easy | string, basic, google |
AGAIN* (1) |
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 | O((d * l) * logd) | O(1) | Medium | Sort, 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 | O(n) | O(n) | Medium | greedy, 2 pointers, good basic ,Manacher's Algorithm , Linkedin ,amazon ,fb |
OK** (5) |
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 | good basic , string , fb |
OK |
681 | Next Closest Time | python | O(1) | O(1) | Medium | subset of set , <= ,strptime , google ,fb |
OK*** (4) |
686 | Repeated String Match | python | O(n + m) | O(1) | Easy | Rabin-Karp Algorithm , google |
AGAIN* (2) |
696 | Count Binary Substrings | python | O(n) | O(1) | Easy | AGAIN (not start*) | |
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) | |
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 ,amazon , fb |
OK** (6) |
796 | Rotate String | python | O(n) | O(1) | Easy | KMP Algorithm , Rabin-Karp Algorithm ,amazon |
OK |
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 | O(n + s) | O(l + s) | Medium | AGAIN (not start) | |
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 |
831 | Masking Personal Information | python | O(1) | O(1) | Medium | regular expression |
OK* |
833 | Find And Replace in String | python | O(n + m) | O(n) | Medium | Union Find | AGAIN (not start) |
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 | O(n^1.5) on average | O(n) | Medium | OK* | |
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) |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
281 | Zigzag Iterator | Python | O(n) | O(k) | Medium | good basic ,๐, google ,fb |
OK*** (3) |
346 | Moving Average from Data Stream | Python | O(1) | O(w) | Easy | ๐, queue, google , fb |
OK** (4) |
933 | Number of Recent Calls | Python | O(1) on average | O(w) | Easy | AGAIN** | |
622 | Design Circular Queue | Python | Medium | good basic ,circular queue ,amazon ,fb |
AGAIN****** (2) | ||
239 | Sliding Window Maximum | Python | Hard | heap, deque, queue,amazon , google |
AGAIN** (2) (not start) |
# | Title | Solution | Time | Space | Difficulty | Note | Status |
---|---|---|---|---|---|---|---|
007 | Reverse Integer | Python | O(1) | O(1) | Easy | 0x7FFFFFFF , amazon |
OK* (2) |
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 |
AGAIN*** (3) |
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 | 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 ******* (5) |
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 | math, AGAIN,fb |
AGAIN**** (4) |
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 | OK* | |
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 | O(n) | O(n) | Medium | 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 | AGAIN (not start) | |
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) | |
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 | ctor: O(n) pick: O(logn) |
O(n) | Medium | AGAIN (not start) | |
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 | AGAIN (not start) | |
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 | |
907 | Sum of Subarray Minimums | Python | O(n) | O(n) | Medium, Ascending Stack | AGAIN (not start) | |
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) |
# | 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 | O(n) | O(1) | Easy | good basic , two pointers , M$ , amazon ,fb |
AGAIN************* (6) |
128 | Longest Consecutive Sequence | Python | Medium | 2 pointers, sort, Blind Top 75 LC pattern, amazon |
AGAIN******** (3) (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 | sort, sort with lambda,amazon |
AGAIN** (2) |
252 | Meeting Rooms | Python | O(nlogn) | O(n) | Easy | ๐,UBER ,amazon , fb |
OK |
253 | Meeting Rooms II | Python | O(nlogn) | O(n) | Medium | ๐,scanning line , trick ,booking.com ,good ,UBER , amazon ,google ,fb |
AGAIN******* (3) |
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 | O(n) | O(n) | Medium | Quick Select, Heap, Bucket Sort,Yelp ,amazon ,fb |
OK* (3) |
406 | Queue Reconstruction by Height | Python | O(n * sqrt(n)) | O(n) | Medium | basic ,trick , sort by key , insert , google |
AGAIN*** (3) |
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 Log Files | Python | O(nlogn * l) | O(l) | Easy | string , amazon |
OK* (3) (again) |
969 | Pancake Sorting | Python | O(n^2) | O(l) | Medium | fb , sorting |
AGAIN******* (3) |
973 | K Closest Points to Origin | Python | O(n) on average | O(1) Medium | sort with lambda, Quick Select, Heap, amazon |
OK* (2) | |
976 | Largest Perimeter Triangle | Python | O(nlogn) | O(1) | Easy | OK* |
# | Title | Solution | Time | Space | Difficulty | Note | Status |
---|---|---|---|---|---|---|---|
019 | Remove Nth Node From End of List | Python | O(n) | O(1) | Medium | linked list ,two pointers ,fb |
AGAIN**** (3) |
086 | Partition List | Python | O(n) | O(1) | Medium | OK* | |
141 | Linked List Cycle | Python | O(n) | O(1) | Easy | 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 | O(n) | O(1) | Medium | good trick ,inverse linkedlist , merge linkedlist ,fb |
AGAIN**** (4) |
167 | Two Sum II - Input array is sorted | Python | O(n) | O(1) | Easy | 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 | O(n) | O(1) | Easy | basic , trick , ,two pointers ,Shopee ,fb |
AGAIN** (4) |
344 | Reverse String | Python | O(n) | O(1) | Easy | OK | |
345 | Reverse Vowels of a String | Python | O(n) | O(1) | Easy | google |
OK |
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 | O(n) | O(1) | Medium | Collections.counter good basic ,sliding window ,substring , good basic ,M$ , fb |
OK********* (7) |
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 | O(m + n) | O(1) | Easy | good basic ,stack ,google , fb |
OK* (4) |
876 | Middle of the Linked List | Python | O(n) | O(1) | Easy | AGAIN | |
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 | |
042 | Trapping Rain Water | Python | Hard | two pointer, amazon , apple |
AGAIN (1) (not start) |
# | 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 | AGAIN (not start) | |
098 | Validate Binary Search Tree | Python | O(n) | O(1) | Medium | recursion, bfs, dfs,BST ,M$ ,amazon , fb |
AGAIN****************** (10) |
100 | Same Tree | Python | O(n) | O(h) | Easy | recursion, dfs, bfs, good basic ,amazon |
OK****** (4) (but again) |
104 | Maximum Depth of Binary Tree | Python | O(n) | O(h) | Easy | DFS, BFS, good basic,amazon |
OK****** (3) (but again) |
105 | Construct Binary Tree from Preorder and Inorder Traversal | Python | O(n) | O(n) | Medium | trick , check # 106,BST ,M$ , fb |
AGAIN********* (8) |
106 | Construct Binary Tree from Inorder and Postorder Traversal | Python | 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 | O(n) | O(h) | Easy | good trick ,dfs , bloomberg ,amazon ,fb |
AGAIN******** (3) |
111 | Minimum Depth of Binary Tree | Python | O(n) | O(h) | Easy | good basic ,dfs ,BST ,amazon ,fb |
AGAIN***** (3) |
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 |
AGAIN****** (5) |
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 | O(n) | O(h) | Medium | dfs, tree, ๐, google |
AGAIN*** (2) |
333 | Largest BST Subtree | Python | O(n) | O(h) | Medium | ๐ | AGAIN (not start) |
337 | House Robber III | Python | O(n) | O(h) | Medium | 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 | O(n) | O(h) | Easy, tree, bfs, dfs | fb |
OK**** (3) |
437 | Path Sum III | Python | O(n) | O(h) | Easy | 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) |
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) |
# | Title | Solution | Time | Space | Difficulty | Tag, Note | Status |
---|---|---|---|---|---|---|---|
033 | Search in Rotated Sorted Array | Python | Medium | binary search ,good basic ,check # 81 Search in Rotated Sorted Array II ,UBER ,amazon ,fb |
AGAIN********* (4) | ||
034 | Find First and Last Position of Element in Sorted Array | Python | Medium | amazon ,fb |
AGAIN**** (1) | ||
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* (3) |
074 | Search a 2D Matrix | Python | O(logm + logn) | O(1) | Medium | binary search in 2D matrix,amazon |
OK* (2) |
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 |
OK***** (5) |
153 | Find Minimum in Rotated Sorted Array | Python | O(logn) | O(1) | Medium | binary search, good basic,amazon |
AGAIN****** (2) |
162 | Find Peak Element | Python | O(logn) | O(1) | Medium | good trick, recursive binary search,M$ , google , fb |
AGAIN******** (5) |
222 | Count Complete Tree Nodes | Python | O((logn)^2) | O(1) | Medium | AGAIN (not start) | |
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 | O(logn) | O(1) | Easy | good basic ,LintCode, fb |
OK*** (5) (but again) |
300 | Longest Increasing Subsequence | Python | O(nlogn) | O(n) | Medium | AGAIN,DP good basic , binary search ,CTCI, LintCode, DP,amazon ,fb |
AGAIN****** (5) |
367 | Valid Perfect Square | Python | 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* | |
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 ,two pointers ,binary search ,amazon ,fb |
OK****** (4) |
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) | Easy | LC 162 Find Peak Element, amazon |
OK* (2) |
875 | Koko Eating Bananas | Python | O(nlogr) | O(1) | Medium | binary search | AGAIN**** (2) |
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) | |
1011 | Capacity To Ship Packages Within D Days | Python | Medium | good trick, binary search, amazon | AGAIN*** (1) (not start) |
# | 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 | O(max(h, k)) | O(min(h, k)) | Medium | good basic BST basic, BST,amazon |
OK********* (3) (but AGAIN) |
235 | Lowest Common Ancestor of a Binary Search Tree | python | O(h) | O(1) | Easy | BST, recursion, iteration, good basic, LCA , check # 236 Lowest Common Ancestor of a Binary Tree , amazon ,fb |
OK**************** (but again)(9) |
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 | good trick,serizlize deserizlize ,BST , tree,check #297, amazon , fb |
AGAIN************* (8) |
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* | |
776 | Split BST | python | O(n) | O(h) | Medium | ๐, BST, tree, DFS, trick, basic, AGAIN ,amazon |
AGAIN******* (5) (not start***) |
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 | ,linked list , good basic UBER , lyft , amazon , google ,fb |
AGAIN***** (5) | ||
968 | Binary Tree Cameras | Python | O(n) | Hard | amazon , dfs, bst, dp, greedy |
AGAIN (not start) |
# | Title | Solution | Time | Space | Difficulty | Tag | Status |
---|---|---|---|---|---|---|---|
102 | Binary Tree Level Order Traversal | Python | O(n) | O(n) | Easy | GOOD basic , dfs , bfs ,UBER , apple ,amazon ,fb |
AGAIN******* (7) (must) |
107 | Binary Tree Level Order Traversal II | Python | O(n) | O(n) | Easy | same as # 102 Binary Tree Level Order Traversal |
OK* (2) |
103 | Binary Tree Zigzag Level Order Traversal | Python | O(n) | O(n) | Medium | amazon ,fb |
OK |
126 | Word Ladder II | Python | Hard | bfs, check # 127 Word Ladder ,amazon |
AGAIN (not start) | ||
127 | Word Ladder | Python | O(n * d) | O(d) | Hard/Medium | check #126 Word Ladder II, bfs ,good trick , UBER , amazon , M$ , fb |
AGAIN********** (8) |
130 | Surrounded Regions | Python | O(m + n) | Medium | bfs , dfs ,union find ,good basic, amazon |
AGAIN***** (4) | |
133 | Clone Graph | Python | O(n) | O(n) | Medium | good trick, check #138 Copy List with Random Pointer ,graph ,dfs ,bfs , copy, UBER , google ,amazon ,fb |
AGAIN********** (7) |
207 | Course Schedule | Python | O(|V| + |E|) | O(|E|) | Medium | Topological Sort,good trick ,dfs , bfs , amazon ,fb |
AGAIN******** (6) (BFS again) |
210 | Course Schedule II | Python | O(|V| + |E|) | O(|E|) | Medium | Topological Sort,check # 207 Course Schedule first, dfs , bfs ,amazon ,fb |
AGAIN******** (7) (BFS again) |
261 | Graph Valid Tree | Python | O(|V| + |E|) | O(|V| + |E|) | Medium | AGAIN, bfs, dfs, grpah, ๐, graph ,quick union ,union find ,google ,amazon ,fb |
AGAIN************* (8) |
286 | Walls and Gates | Python | 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 | O(n * s) | O(n) | Medium | ๐ Topological Sort , google , airbnb |
AGAIN** (3) (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 | O(n) | O(n) | Medium | AGAIN, Graph, bfs+dfs, search, good trick , amazon |
AGAIN********** (6) |
743 | Network Delay Time | Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's algorithm |
AGAIN (not start) |
752 | Open the Lock | Python | O(k * n^k + d) | O(k * n^k + d) | Medium | 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 |
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 | Medium | 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 | Medium | BFS, dp amazon |
AGAIN (not start) | ||
1162 | As Far from Land as Possible | Python | Medium | dfs, bfs, good basic, amazon |
AGAIN (1) (not start) | ||
1730 | Shortest Path to Get Food | Python | Medium | bfs, amazon |
OK (1) |
# | Title | Solution | Time | Space | Difficulty | Tag | Status |
---|---|---|---|---|---|---|---|
112 | Path Sum | Python, Scala | O(n) | O(h) | Easy | good concept , amazon , dfs |
OK** (2) |
113 | Path Sum II | Python | O(n) | O(h) | Medium | dfs, LC 112 Path Sum ,good basic , amazon , fb |
AGAIN****** (5) |
199 | Binary Tree Right Side View | Python | O(n) | O(h) | Medium | good basic , dfs , bfs ,apple ,amazon , fb |
OK*** (5) |
200 | Number of Islands | Python | O(m * n) | O(m * n) | Medium | 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 | O(n) | O(h) | Medium | trick ,EPI, LCA ,check 235 Lowest Common Ancestor of a Binary Search Tree ,apple ,amazon ,linkedin ,fb |
AGAIN************* (8) |
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 | O(n * h) | O(h) | Easy | apple , google , amazon , fb |
OK******* (4) |
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 | O(m * n) | O(m * n) | Medium | dfs, matrix, m$ ,google |
AGAIN* (2) |
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**** (3) (not start) | ||
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 | amazon , dfs, bfs, graph, union find |
AGAIN (not start) |
582 | Kill Process | Python | O(n) | O(n) | Medium | ๐, DFS, BFS,good basic ,bloomberg |
AGAIN** (3) |
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 |
OK***** (5) |
695 | Max Area of Island | Python | O(m * n) | O(m * n) | Easy | 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) | ||
733 | Flood Fill | Python | O(m * n) | O(m * n) | Easy | fb , amazon , good basic |
OK**** (4) |
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 | O(|V| + |E|) | O(|V|) | Medium | Topological Sort |
AGAIN (3) (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) |
1192 | Critical Connections in a Network | Python | O(q + r) | O(q + r) | Hard | amazon ,dfs, graph |
AGAIN (not start) |
# | Title | Solution | Time | Space | Difficulty | Tag, Note | Status |
---|---|---|---|---|---|---|---|
017 | Letter Combinations of a Phone Number | Python | O(n * 4^n) | O(n) | Medium | dfs, backtrack, good trick ,UBER , amazon , google , fb |
AGAIN************* (9) (again !) |
022 | Generate Parentheses | Python | O(4^n / n^(3/2)) | O(n) | Medium | LC 20, good basic, DFS, backtracking,amazon |
OK******* (3) (but again) |
039 | Combination Sum | Python | O(k * n^k) | O(k) | Medium | backtrack,dfs ,good basic ,UBER , airbnb , amazon ,fb |
OK********* (7) (but again) |
040 | Combination Sum II | Python | O(k * C(n, k)) | O(k) | Medium | similar as #39 Combination Sum |
AGAIN*** (3) (again) |
046 | Permutations | Python | 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 |
AGAIN (not start) |
077 | Combinations | Python | O(O(k * C(n, k))) | O(k) | Medium | good trick, backtrack | OK********** (4) (but again, MUST) |
079 | Word Search | Python | O(m * n * l) | O(l) | Medium | back tracking,good trick ,dfs ,bloomberg , M$ , amazon ,fb |
AGAIN************* (7) (again!) |
093 | Restore IP Addresses | Python | O(1) | O(1) | Medium | good trick,recursive,IP address,amazon |
AGAIN****** (4) |
078 | Subsets | Python | 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 | O(n * 2^n) | O(1) | Medium | good basic,check # 078 Subsets , dfs, backtrack, fb |
AGAIN********* (6) |
131 | Palindrome Partitioning | Python | O(n^2) ~ O(2^n) | O(n^2) | Medium | dfs, backtracking, good trick,amazon |
AGAIN******** (4) |
212 | Word Search II | Python | O(m * n * l) | O(l) | Hard | not start | |
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*) |
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) |
# | Title | Solution | Time | Space | Difficulty | Tag | Status |
---|---|---|---|---|---|---|---|
053 | Maximum Subarray | Python | O(n) | O(1) | Medium | DP ,dp basic ,amazon ,fb |
AGAIN*** (4) |
062 | Unique Paths | Python | O(m * n) | O(m + n) | Medium | dp , basic |
AGAIN* |
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 | O(logn) | O(1) | Easy | Matrix Exponentiation, DP , recursion |
OK* |
091 | Decode Ways | Python | O(n) | O(1) | Medium | good basic ,dp , M$ , UBER , amazon ,fb |
AGAIN*********** (3) |
096 | Unique Binary Search Trees | Python | O(n) | O(1) | Medium | Math | AGAIN (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) | Medium | amazon |
AGAIN* (not start) (1) |
139 | Word Break | Python | O(n * l^2) | O(n) | Medium | dp ,trick ,UBER ,yahoo ,amazon , google ,fb |
AGAIN******** (4) |
152 | Maximum Product Subarray | Python | O(n) | O(1) | Medium | AGAIN (not start) | |
198 | House Robber | Python | O(n) | O(1) | Easy | dp basic,amazon |
AGAIN*** (2) |
213 | House Robber II | Python | O(n) | O(1) | Medium | AGAIN (not start) | |
221 | Maximal Square | Python | O(n^2) | O(n) | Medium | EPI, dp, amazon ,fb |
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 | O(n * k) | O(k) | Medium | dp, bfs,amazon |
AGAIN** (not start) |
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) |
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 | AGAIN, dp basic ,fb |
AGAIN******** (3) |
416 | Partition Equal Subset Sum | Python | O(n * s) | O(s) | Medium | AGAIN (not start) | |
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) | Medium | good trick ,dp , dfs ,amazon |
AGAIN****** |
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) |
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) |
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 | 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 | O(n) | O(n) | Medium | dp , google |
AGAIN (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 | google |
AGAIN (not start) |
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) |
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 |
# | Title | Solution | Time | Space | Difficulty | Tag, Note | Status |
---|---|---|---|---|---|---|---|
011 | Container With Most Water | Python | O(n) | O(1) | Medium | good basics, two pointers ,fb , amazon |
OK*** (3) (but again !!) |
055 | Jump Game | Python | O(n) | O(1) | Medium | good trick, Greedy, DP, amazon |
AGAIN******** (5) |
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 | O(n) | O(1) | Medium | trick, greedy,amazon |
AGAIN****** (5) |
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 | O(nlogn) | O(1) | Medium | good trick, 2 pointers, inverval, similiar as #452 Minimum Number of Arrows to Burst Balloons , Line Sweep, google |
AGAIN********* (6) |
452 | Minimum Number of Arrows to Burst Balloons | Python | O(nlogn) | O(1) | Medium | AGAIN* | |
455 | Assign Cookies | Python | O(nlogn) | O(1) | Easy | OK* | |
621 | Task Scheduler | Python | 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 | O(n) | O(1) | Medium | AGAIN (not start*) | |
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*********** (5) |
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) | ||
1648 | Sell Diminishing-Valued Colored Balls | Python | Medium | binary search, greedy, amazon |
AGAIN* (not start) | ||
1710 | Maximum Units on a Truck | Python | Easy | greedy, amazon |
AGAIN*** (1) (not start) |
# | Title | Solution | Time | Space | Difficulty | Status | Note |
---|---|---|---|---|---|---|---|
959 | Regions Cut By Slashes | C++ Python | O(n^2) | O(n^2) | Medium | Union Find | |
323 | Number of Connected Components in an Undirected Graph | Python | O(n) | O(n) | Medium | ๐ , Union Find, graph , linkedin , amazon |
AGAIN**** (3) (not start) |
269 | Alien Dictionary | Python | Hard | dfs, bfs, topology sorting, fb |
AGAIN* (not start) |
# | 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 |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
0146 | LRU Cache | Python | O(1) | O(k) | Hard | LRU,Least Recently Used, LinkedHashMap, LinkedList, amazon |
AGAIN** (not start) |
0225 | Implement Stack using Queues | C++ Python | push: O(n), pop: O(1), top: O(1) | O(n) | Easy | ||
284 | Peeking Iterator | C++ Python | O(1) | O(1) | Medium | good basic, google , apple |
not start*** (1) |
0348 | Design Tic-Tac-Toe | Python | O(1) | O(n^2) | Medium | ๐, fb |
AGAIN** (3) |
0353 | Design Snake Game | C++ Python | O(1) | O(s) | Medium | ๐ | Deque |
355 | Design Twitter | Python | O(klogu) | O(t + f) | Medium | good trick, data structure, heapq, defaultdict, amazon |
OK******** (5) |
0359 | Logger Rate Limiter | C++ Python | O(1), amortized | O(k) | Easy | ๐ | Deque |
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 | ๐, amazon | AGAIN** (not start) |
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 | O(n) | O(1) | Medium | ||
1146 | Snapshot Array | C++ Python | set: O(1) get: O(logn) |
O(n) | Medium | ||
1166 | Design File System | C++ Python | create: O(n) get: O(n) |
O(n) | Medium | ๐ | |
1172 | Dinner Plate Stacks | C++ Python | push: O(logn) pop: O(1), amortized popAtStack: (logn) |
O(n * c) | Hard | ||
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 | C++ Python | ctor: O(n * l) suggest: O(l^2) |
O(t) | Medium | Trie | |
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 | ||
1500 | Design a File Sharing System | Python | O(k) | O(k) | Medium | design, hashmap | AGAIN*** (not start) |
1656 | Design an Ordered Stream | Python | O(k) | O(k) | East | ||
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, | |
1797 | Design Authentication Manager | Python | O(k) | O(k) | Medium | ||
1976 | Number of Ways to Arrive at Destination | Python | O(k) | O(k) | Medium |
# | Title | Solution | Time | Space | Difficulty | Status | Note |
---|---|---|---|---|---|---|---|
874 | Walking Robot Simulation | C++ Python | O(n + k) | O(k) | Easy |
# | 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 | ๐ |
# | 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 | 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) |
# | 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 |