- R.I.P. to my old Leetcode repository, where there were
5.7k+stars and2.2k+forks (ever the top 3 in the field). - Since free questions may be even mistakenly taken down by some companies, only solutions will be post on now.
- There are new LeetCode questions every week. I'll keep updating for full summary and better solutions.
- For more problem solutions, you can see my LintCode, GoogleKickStart, GoogleCodeJamIO repositories.
- For more challenging problem solutions, you can also see my GoogleCodeJam, MetaHackerCup repositories.
- Hope you enjoy the journey of learning data structures and algorithms.
- Notes: "π" means your subscription of LeetCode premium membership is required for reading the question.
- Bit Manipulation
- Array
- String
- Linked List
- Stack
- Queue
- Binary Heap
- Tree
- Hash Table
- Math
- Sort
- Two Pointers
- Recursion
- Binary Search
- Binary Search Tree
- Breadth-First Search
- Depth-First Search
- Backtracking
- Dynamic Programming
- Greedy
- Graph
- Geometry
- Simulation
- Design
- Concurrency
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0136 | Single Number | C++ Python | O(n) | O(1) | Easy | ||
| 0137 | Single Number II | C++ Python | O(n) | O(1) | Medium | ||
| 0190 | Reverse Bits | C++ Python | O(1) | O(1) | Easy | ||
| 0191 | Number of 1 Bits | C++ Python | O(1) | O(1) | Easy | ||
| 0201 | Bitwise AND of Numbers Range | C++ Python | O(1) | O(1) | Medium | ||
| 0231 | Power of Two | C++ Python | O(1) | O(1) | Easy | LintCode | |
| 0260 | Single Number III | C++ Python | O(n) | O(1) | Medium | ||
| 0268 | Missing Number | C++ Python | O(n) | O(1) | Medium | LintCode | |
| 0318 | Maximum Product of Word Lengths | C++ Python | O(n) ~ O(n^2) | O(n) | Medium | Bit Manipulation, Counting Sort, Pruning | |
| 0342 | Power of Four | C++ Python | O(1) | O(1) | Easy | ||
| 0371 | Sum of Two Integers | C++ Python | O(1) | O(1) | Easy | LintCode | |
| 0389 | Find the Difference | C++ Python | O(n) | O(1) | Easy | ||
| 0393 | UTF-8 Validation | C++ Python | O(n) | O(1) | Medium | ||
| 0401 | Binary Watch | C++ Python | O(1) | O(1) | Easy | ||
| 0411 | Minimum Unique Word Abbreviation | C++ Python | O((d + n) * 2^n) | O(d) | Hard | π | |
| 0421 | Maximum XOR of Two Numbers in an Array | C++ Python | O(nlogr) | O(t) | Medium | Greedy, Trie | |
| 0461 | Hamming Distance | C++ Python | O(1) | O(1) | Easy | ||
| 0476 | Number Complement | C++ Python | O(1) | O(1) | Easy | Bit Manipulation | |
| 0477 | Total Hamming Distance | C++ Python | O(n) | O(1) | Medium | ||
| 0645 | Set Mismatch | C++ Python | O(n) | O(1) | Easy | ||
| 0693 | Binary Number with Alternating Bits | C++ Python | O(1) | O(1) | Easy | ||
| 0762 | Prime Number of Set Bits in Binary Representation | C++ Python | O(1) | O(1) | Easy | ||
| 0868 | Binary Gap | C++ Python | O(1) | O(1) | Easy | ||
| 0898 | Bitwise ORs of Subarrays | C++ Python | O(n) | O(1) | Medium |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0020 | Valid Parentheses | C++ Python | O(n) | O(n) | Easy | ||
| 0032 | Longest Valid Parentheses | C++ Python | O(n) | O(1) | Hard | ||
| 0071 | Simplify Path | C++ Python | O(n) | O(n) | Medium | ||
| 0084 | Largest Rectangle in Histogram | C++ Python | O(n) | O(n) | Hard | Mono Stack, DP | |
| 0085 | Maximal Rectangle | C++ Python | O(m * n) | O(n) | Hard | EPI | Mono Stack |
| 0101 | Symmetric Tree | C++ Python | O(n) | O(h) | Easy | ||
| 0150 | Evaluate Reverse Polish Notation | C++ Python | O(n) | O(n) | Medium | ||
| 0155 | Min Stack | C++ Python | O(n) | O(1) | Easy | ||
| 0224 | Basic Calculator | C++ Python | O(n) | O(n) | Hard | ||
| 0227 | Basic Calculator II | C++ Python | O(n) | O(n) | Medium | ||
| 0232 | Implement Queue using Stacks | C++ Python | O(1), amortized | O(n) | Easy | EPI, LintCode | |
| 0255 | Verify Preorder Sequence in Binary Search Tree | C++ Python | O(n) | O(1) | Medium | π | |
| 0272 | Closest Binary Search Tree Value II | C++ Python | O(h + k) | O(h) | Hard | π | |
| 0331 | Verify Preorder Serialization of a Binary Tree | C++ Python | O(n) | O(1) | Medium | ||
| 0341 | Flatten Nested List Iterator | C++ Python | O(n) | O(h) | Medium | π | Iterator |
| 0385 | Mini Parser | C++ Python | O(n) | O(h) | Medium | ||
| 0394 | Decode String | C++ Python | O(n) | O(n) | Medium | ||
| 0439 | Ternary Expression Parser | C++ Python | O(n) | O(1) | Medium | π | |
| 0456 | 132 Pattern | C++ Python | O(n) | O(n) | Medium | ||
| 0496 | Next Greater Element I | C++ Python | O(m + n) | O(m + n) | Easy | Mono Stack | |
| 0503 | Next Greater Element II | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
| 0636 | Exclusive Time of Functions | C++ Python | O(n) | O(n) | Medium | ||
| 0682 | Baseball Game | C++ Python | O(n) | O(n) | Easy | ||
| 0726 | Number of Atoms | C++ Python | O(n) | O(n) | Hard | ||
| 0735 | Asteroid Collision | C++ Python | O(n) | O(n) | Medium | ||
| 0736 | Parse Lisp Expression | C++ Python | O(n^2) | O(n^2) | Hard | ||
| 0739 | Daily Temperatures | C++ Python | O(n) | O(n) | Medium | ||
| 0770 | Basic Calculator IV | C++ Python | add: O(d * t) sub: O(d * t) mul: O(d * t^2) eval: O(d * t) to_list: O(d * tlogt) |
O(e + d * t) | Hard | ||
| 0772 | Basic Calculator III | C++ Python | O(n) | O(n) | Hard | ||
| 0853 | Car Fleet | C++ Python | O(nlogn) | O(n) | Medium | ||
| 0856 | Score of Parentheses | C++ Python | O(n) | O(1) | Medium | ||
| 0872 | Leaf-Similar Trees | C++ Python | O(n) | O(h) | Easy | ||
| 0895 | Maximum Frequency Stack | C++ Python | O(1) | O(n) | Hard | Hash | |
| 0901 | Online Stock Span | C++ Python | O(n) | O(n) | Medium | ||
| 0921 | Minimum Add to Make Parentheses Valid | C++ Python | O(n) | O(1) | Medium | ||
| 0946 | Validate Stack Sequences | C++ Python | O(n) | O(n) | Medium |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0239 | Sliding Window Maximum | C++ Python | O(n) | O(k) | Hard | EPI, LintCode | Mono Deque |
| 0281 | Zigzag Iterator | C++ Python | O(n) | O(k) | Medium | π | |
| 0346 | Moving Average from Data Stream | C++ Python | O(1) | O(w) | Easy | π | |
| 0933 | Number of Recent Calls | C++ Python | O(1) on average | O(w) | Easy |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0264 | Ugly Number II | C++ Python | O(n) | O(1) | Medium | CTCI, LintCode | BST, Heap |
| 0295 | Find Median from Data Stream | C++ Python | O(nlogn) | O(n) | Hard | EPI, LintCode | BST, Heap |
| 0313 | Super Ugly Number | C++ Python | O(n * k) | O(n + k) | Medium | BST, Heap | |
| 0358 | Rearrange String k Distance Apart | C++ Python | O(n) | O(c) | Hard | π | Greedy, Heap |
| 0373 | Find K Pairs with Smallest Sums | C++ Python | O(k * log(min(n, m, k))) | O(min(n, m, k)) | Medium | ||
| 0378 | Kth Smallest Element in a Sorted Matrix | C++ Python | O(k * log(min(n, m, k))) | O(min(n, m, k)) | Medium | LintCode | |
| 0407 | Trapping Rain Water II | C++ Python | O(m * n * (logm + logn)) | O(m * n) | Hard | LintCode | |
| 0480 | Sliding Window Median | C++ Python | O(nlogk) | O(k) | Hard | BST, Heap | |
| 0502 | IPO | C++ Python | O(nlogn) | O(n) | Hard | Heap | |
| 0632 | Smallest Range | C++ Python | O(nlogk) | O(k) | Hard | ||
| 0703 | Kth Largest Element in a Stream | C++ Python | O(nlogk) | O(k) | Easy | ||
| 0846 | Hand of Straights | C++ Python | O(nlogn) | O(n) | Medium | ||
| 0855 | Exam Room | C++ Python | seat: O(logn) leave: O(logn) |
O(n) | Medium | BST, Hash | |
| 0857 | Minimum Cost to Hire K Workers | C++ Python | O(nlogn) | O(n) | Hard | Sort | |
| 0871 | Minimum Number of Refueling Stops | C++ Python | O(nlogn) | O(n) | Hard | Sort |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0094 | Binary Tree Inorder Traversal | C++ Python | O(n) | O(1) | Medium | Morris Traversal |
|
| 0099 | Recover Binary Search Tree | C++ Python | O(n) | O(1) | Hard | Morris Traversal |
|
| 0144 | Binary Tree Preorder Traversal | C++ Python | O(n) | O(1) | Medium | Morris Traversal |
|
| 0145 | Binary Tree Postorder Traversal | C++ Python | O(n) | O(1) | Hard | Morris Traversal |
|
| 0208 | Implement Trie (Prefix Tree) | C++ Python | O(n) | O(1) | Medium | Trie | |
| 0211 | Add and Search Word - Data structure design | C++ Python | O(min(n, h)) | O(min(n, h)) | Medium | Trie, DFS | |
| 0226 | Invert Binary Tree | C++ Python | O(n) | O(h), O(w) | Easy | ||
| 0297 | Serialize and Deserialize Binary Tree | C++ Python | O(n) | O(h) | Hard | LintCode | DFS |
| 0307 | Range Sum Query - Mutable | C++ Python | ctor: O(n), update: O(logn), query: O(logn) | O(n) | Medium | LintCode | DFS, Segment Tree, BIT, Fenwick Tree |
| 0308 | Range Sum Query 2D - Mutable | C++ Python | ctor: O(m * n), update: O(logm * logn), query: O(logm * logn) | O(m * n) | Hard | π | DFS, Quad Tree, 2D BIT, 2D Fenwick Tree |
| 0315 | Count of Smaller Numbers After Self | C++ Python | O(nlogn) | O(n) | Hard | LintCode | BST, BIT, Fenwick Tree, Divide and Conquer, Merge Sort |
| 0426 | Convert Binary Search Tree to Sorted Doubly Linked List | C++ Python | O(n) | O(h) | Medium | π | |
| 0427 | Construct Quad Tree | C++ Python | O(n) | O(h) | Medium | ||
| 0428 | Serialize and Deserialize N-ary Tree | C++ Python | O(n) | O(h) | Hard | π | |
| 0429 | N-ary Tree Level Order Traversal | C++ Python | O(n) | O(w) | Medium | ||
| 0430 | Flatten a Multilevel Doubly Linked List | C++ Python | O(n) | O(1) | Medium | ||
| 0431 | Encode N-ary Tree to Binary Tree | C++ Python | O(n) | O(h) | Hard | π | |
| 0501 | Find Mode in Binary Search Tree | C++ Python | O(n) | O(1) | Easy | Tree, Inorder Traversal | |
| 0508 | Most Frequent Subtree Sum | C++ Python | O(n) | O(n) | Medium | Tree, DFS, Hash | |
| 0513 | Find Bottom Left Tree Value | C++ Python | O(n) | O(h) | Medium | Tree, DFS, BFS | |
| 0525 | Contiguous Array | C++ Python | O(n) | O(n) | Medium | ||
| 0529 | Minesweeper | C++ Python | O(m * n) | O(m + n) | Medium | ||
| 0536 | Construct Binary Tree from String | C++ Python | O(n) | O(h) | Medium | π | |
| 0538 | Convert BST to Greater Tree | C++ Python | O(n) | O(h) | Easy | ||
| 0543 | Diameter of Binary Tree | C++ Python | O(n) | O(h) | Easy | ||
| 0545 | Boundary of Binary Tree | C++ Python | O(n) | O(h) | Medium | π | |
| 0548 | Split Array with Equal Sum | C++ Python | O(n^2) | O(n) | Medium | π | |
| 0558 | Logical OR of Two Binary Grids Represented as Quad-Trees | C++ Python | O(n) | O(h) | Medium | Tree, Divide and Conquer | |
| 0559 | Max Consecutive Ones | C++ Python | O(n) | O(h) | Easy | Tree, DFS | |
| 0563 | Binary Tree Tilt | C++ Python | O(n) | O(n) | Easy | ||
| 0572 | Subtree of Another Tree | C++ Python | O(m * n) | O(h) | Easy | ||
| 0589 | N-ary Tree Preorder Traversal | C++ Python | O(n) | O(h) | Easy | Tree, Preorder Traversal | |
| 0590 | N-ary Tree Postorder Traversal | C++ Python | O(n) | O(h) | Medium | Tree, Preorder Traversal | |
| 0606 | Construct String from Binary Tree | C++ Python | O(n) | O(h) | Easy | ||
| 0617 | Merge Two Binary Trees | C++ Python | O(n) | O(h) | Easy | ||
| 0623 | Add One Row to Tree | C++ Python | O(n) | O(h) | Medium | ||
| 0637 | Average of Levels in Binary Tree | C++ Python | O(n) | O(h) | Easy | ||
| 0652 | Find Duplicate Subtrees | C++ Python | O(n) | O(n) | Medium | DFS, Hash | |
| 0653 | Two Sum IV - Input is a BST | C++ Python | O(n) | O(h) | Easy | Two Pointers | |
| 0654 | Maximum Binary Tree | C++ Python | O(n) | O(n) | Medium | LintCode | Mono Stack, Cartesian Tree |
| 0655 | Print Binary Tree | C++ Python | O(n) | O(h) | Medium | ||
| 0662 | Maximum Width of Binary Tree | C++ Python | O(n) | O(h) | Medium | DFS | |
| 0663 | Equal Tree Partition | C++ Python | O(n) | O(n) | Medium | π | Hash |
| 0677 | Map Sum Pairs | C++ Python | O(n) | O(t) | Medium | Trie | |
| 0684 | Redundant Connection | C++ Python | O(n) | O(n) | Medium | Union Find | |
| 0685 | Redundant Connection II | C++ Python | O(n) | O(n) | Hard | Union Find | |
| 0687 | Longest Univalue Path | C++ Python | O(n) | O(h) | Easy | ||
| 0699 | Falling Squares | C++ Python | O(nlogn) | O(n) | Hard | Segment Tree | |
| 0700 | Search in a Binary Search Tree | C++ Python | O(h) | O(1) | Easy | Tree | |
| 0701 | Insert into a Binary Search Tree | C++ Python | O(h) | O(1) | Medium | Tree | |
| 0814 | Binary Tree Pruning | C++ Python | O(n) | O(h) | Medium | DFS | |
| 0850 | Rectangle Area II | C++ Python | O(nlogn) | O(n) | Hard | Segment Tree | |
| 0863 | All Nodes Distance K in Binary Tree | C++ Python | O(n) | O(n) | Medium | DFS + BFS | |
| 0865 | Smallest Subtree with all the Deepest Nodes | C++ Python | O(n) | O(h) | Medium | DFS | |
| 0889 | Construct Binary Tree from Preorder and Postorder Traversal | C++ Python | O(n) | O(h) | Medium | DFS, Stack | |
| 0897 | Increasing Order Search Tree | C++ Python | O(n) | O(h) | Easy | DFS | |
| 0919 | Complete Binary Tree Inserter | C++ Python | ctor: O(n) insert: O(1) get_root: O(1) |
O(n) | Medium | ||
| 0938 | Range Sum of BST | C++ Python | O(n) | O(h) | Medium | DFS | |
| 0951 | Flip Equivalent Binary Trees | C++ Python | O(n) | O(h) | Medium | DFS | |
| 0958 | Check Completeness of a Binary Tree | C++ Python | O(n) | O(w) | Medium | BFS | |
| 0965 | Univalued Binary Tree | C++ Python | O(n) | O(h) | Easy | DFS | |
| 0971 | Flip Binary Tree To Match Preorder Traversal | C++ Python | O(n) | O(h) | Medium | DFS | |
| 0979 | Distribute Coins in Binary Tree | C++ Python | O(n) | O(h) | Medium | DFS | |
| 0987 | Vertical Order Traversal of a Binary Tree | C++ Python | O(nlogn) | O(n) | Medium | DFS | |
| 0988 | Smallest String Starting From Leaf | C++ Python | O(n + l * h) | O(h) | Medium | DFS | |
| 0993 | Cousins in Binary Tree | C++ Python | O(n) | O(h) | Easy | DFS | |
| 0998 | Maximum Binary Tree II | C++ Python | O(h) | O(1) | Medium | Cartesian Tree |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0007 | Reverse Integer | C++ Python | O(1) | O(1) | Easy | ||
| 0009 | Palindrome Number | C++ Python | O(1) | O(1) | Easy | ||
| 0012 | Integer to Roman | C++ Python | O(n) | O(1) | Medium | ||
| 0013 | Roman to Integer | C++ Python | O(n) | O(1) | Easy | ||
| 0029 | Divide Two Integers | C++ Python | O(1) | O(1) | Medium | ||
| 0050 | Pow(x, n) | C++ Python | O(logn) | O(1) | Medium | ||
| 0060 | Permutation Sequence | C++ Python | O(n^2) | O(n) | Medium | Cantor Ordering |
|
| 0065 | Valid Number | C++ Python | O(n) | O(1) | Hard | Automata |
|
| 0089 | Gray Code | C++ Python | O(2^n) | O(1) | Medium | ||
| 0166 | Fraction to Recurring Decimal | C++ Python | O(logn) | O(1) | Medium | ||
| 0168 | Excel Sheet Column Title | C++ Python | O(logn) | O(1) | Easy | ||
| 0171 | Excel Sheet Column Number | C++ Python | O(n) | O(1) | Easy | ||
| 0172 | Factorial Trailing Zeroes | C++ Python | O(1) | O(1) | Easy | ||
| 0223 | Rectangle Area | C++ Python | O(1) | O(1) | Easy | ||
| 0233 | Number of Digit One | C++ Python | O(1) | O(1) | Hard | CTCI, LintCode | |
| 0248 | Strobogrammatic Number III | C++ Python | O(5^(n/2)) | O(n) | Hard | π | |
| 0258 | Add Digits | C++ Python | O(1) | O(1) | Easy | ||
| 0263 | Ugly Number | C++ Python | O(1) | O(1) | Easy | ||
| 0292 | Nim Game | C++ Python | O(1) | O(1) | Easy | LintCode | |
| 0319 | Bulb Switcher | C++ Python | O(1) | O(1) | Medium | ||
| 0326 | Power of Three | C++ Python | O(1) | O(1) | Easy | ||
| 0335 | Self Crossing | C++ Python | O(n) | O(1) | Hard | ||
| 0338 | Counting Bits | C++ Python | O(n) | O(n) | Medium | ||
| 0343 | Integer Break | C++ Python | O(logn) | O(1) | Medium | Tricky, DP | |
| 0365 | Water and Jug Problem | C++ Python | O(logn) | O(1) | Medium | BΓ©zout's identity |
|
| 0372 | Super Pow | C++ Python | O(n) | O(1) | Medium | ||
| 0382 | Linked List Random Node | C++ Python | ctor: O(n) getRandom: O(1) |
O(n) | Medium | Reservoir Sampling |
|
| 0386 | Lexicographical Numbers | C++ Python | O(n) | O(1) | Medium | ||
| 0390 | Elimination Game | C++ Python | O(logn) | O(1) | Medium | ||
| 0391 | Perfect Rectangle | C++ Python | O(n) | O(n) | Hard | ||
| 0398 | Random Pick Index | C++ Python | ctor: O(n) pick: O(1) |
O(n) | Medium | Reservoir Sampling, Hash Table |
|
| 0400 | Nth Digit | C++ Python | O(logn) | O(1) | Easy | ||
| 0413 | Arithmetic Slices | C++ Python | O(n) | O(1) | Medium | ||
| 0423 | Reconstruct Original Digits from English | C++ Python | O(n) | O(1) | Medium | GCJ2016 - Round 1B | |
| 0441 | Arranging Coins | C++ Python | O(nlogn) | O(1) | Easy | Binary Search | |
| 0453 | Minimum Moves to Equal Array Elements | C++ Python | O(n) | O(1) | Easy | ||
| 0458 | Poor Pigs | C++ Python | O(n) | O(1) | Easy | ||
| 0469 | Convex Polygon | C++ Python | O(n) | O(1) | Medium | π | |
| 0470 | Implement Rand10() Using Rand7() | C++ Python | O(1) | O(1) | Medium | ||
| 0478 | Generate Random Point in a Circle | C++ Python | O(1) | O(1) | Medium | ||
| 0479 | Largest Palindrome Product | C++ Python | O(n * 10^N) | O(n) | Hard | Math | |
| 0483 | Smallest Good Base | C++ Python | O(logn * log(logn)) | O(1) | Hard | Math | |
| 0492 | Construct the Rectangle | C++ Python | O(1) | O(1) | Easy | Math | |
| 0497 | Random Point in Non-overlapping Rectangles | C++ Python | ctor: O(n) pick: O(logn) |
O(n) | Medium | ||
| 0504 | Base 7 | C++ Python | O(n1) | O(1) | Easy | Math | |
| 0507 | Perfect Number | C++ Python | O(sqrt(n)) | O(1) | Easy | Math | |
| 0517 | Super Washing Machines | C++ Python | O(n) | O(1) | Hard | ||
| 0519 | Random Flip Matrix | C++ Python | ctor: O(1) pick: O(1) reset: O(n) |
O(n) | Medium | ||
| 0528 | Random Pick with Weight | C++ Python | ctor: O(n) pick: O(logn) |
O(n) | Medium | ||
| 0537 | Complex Number Multiplication | C++ Python | O(1) | O(1) | Medium | ||
| 0553 | Optimal Division | C++ Python | O(n) | O(1) | Medium | ||
| 0573 | Squirrel Simulation | C++ Python | O(n) | O(1) | Medium | π | |
| 0592 | Fraction Addition and Subtraction | C++ Python | O(nlogx) | O(n) | Medium | ||
| 0593 | Valid Square | C++ Python | O(1) | O(1) | Medium | ||
| 0598 | Range Addition II | C++ Python | O(p) | O(1) | Easy | ||
| 0625 | Minimum Factorization | C++ Python | O(loga) | O(1) | Medium | π | |
| 0628 | Maximum Product of Three Numbers | C++ Python | O(n) | O(1) | Easy | ||
| 0633 | Sum of Square Numbers | C++ Python | O(sqrt(c) * logc) | O(1) | Easy | ||
| 0634 | Find the Derangement of An Array | C++ Python | O(n) | O(1) | Medium | π | |
| 0640 | Solve the Equation | C++ Python | O(n) | O(n) | Medium | ||
| 0651 | 4 Keys Keyboard | C++ Python | O(1) | O(1) | Medium | π | Math, DP |
| 0660 | Remove 9 | C++ Python | O(logn) | O(1) | Hard | π | |
| 0672 | Bulb Switcher II | C++ Python | O(1) | O(1) | Medium | ||
| 0728 | Self Dividing Numbers | C++ Python | O(n) | O(1) | Medium | ||
| 0754 | Reach a Number | C++ Python | O(logn) | O(1) | Medium | ||
| 0775 | Global and Local Inversions | C++ Python | O(n) | O(1) | Medium | ||
| 0779 | K-th Symbol in Grammar | C++ Python | O(1) | O(1) | Medium | ||
| 0780 | Reaching Points | C++ Python | O(log(max(m, n))) | O(1) | Hard | ||
| 0781 | Rabbits in Forest | C++ Python | O(n) | O(n) | Medium | ||
| 0782 | Transform to Chessboard | C++ Python | O(n^2) | O(n) | Hard | ||
| 0789 | Escape The Ghosts | C++ Python | O(n) | O(1) | Medium | ||
| 0800 | Similar RGB Color | C++ Python | O(1) | O(1) | Easy | π | |
| 0810 | Chalkboard XOR Game | C++ Python | O(1) | O(1) | Hard | ||
| 0812 | Largest Triangle Area | C++ Python | O(n^3) | O(1) | Easy | ||
| 0829 | Consecutive Numbers Sum | C++ Python | O(sqrt(n)) | O(1) | Hard | Factorization | |
| 0836 | Rectangle Overlap | C++ Python | O(1) | O(1) | Easy | ||
| 0858 | Mirror Reflection | C++ Python | O(1) | O(1) | Medium | ||
| 0866 | Prime Palindrome | C++ Python | O(n^(1/2) * (logn + n^(1/2))) | O(logn) | Medium | ||
| 0883 | Projection Area of 3D Shapes | C++ Python | O(n^2) | O(1) | Easy | ||
| 0887 | Super Egg Drop | C++ Python | O(klogn) | O(1) | Hard | ||
| 0891 | Sum of Subsequence Widths | C++ Python | O(n) | O(1) | Hard | ||
| 0899 | Orderly Queue | C++ Python | O(n^2) | O(n) | Hard | ||
| 0902 | Numbers At Most N Given Digit Set | C++ Python | O(logn) | O(logn) | Hard | ||
| 0906 | Super Palindromes | C++ Python | O(n^0.25 * logn) | O(logn) | Hard | ||
| 0907 | Sum of Subarray Minimums | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
| 0908 | Smallest Range I | C++ Python | O(n) | O(1) | Easy | ||
| 0910 | Smallest Range II | C++ Python | O(nlogn) | O(1) | Medium | ||
| 0914 | X of a Kind in a Deck of Cards | C++ Python | O(n * (logn)^2) | O(n) | Easy | ||
| 0963 | Minimum Area Rectangle II | C++ Python | O(n^2) ~ O(n^3) | O(n^2) | Medium | ||
| 0970 | Powerful Integers | C++ Python | O((logn)^2) | O(r) | Easy | ||
| 0972 | Equal Rational Numbers | C++ Python | O(1) | O(1) | Hard |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0056 | Merge Intervals | C++ Python | O(nlogn) | O(1) | Hard | ||
| 0057 | Insert Interval | C++ Python | O(n) | O(1) | Hard | ||
| 0075 | Sort Colors | C++ Python | O(n) | O(1) | Medium | Tri Partition | |
| 0088 | Merge Sorted Array | C++ Python | O(n) | O(1) | Easy | ||
| 0147 | Insertion Sort List | C++ Python | O(n^2) | O(1) | Medium | ||
| 0148 | Sort List | C++ Python | O(nlogn) | O(logn) | Medium | ||
| 0164 | Maximum Gap | C++ Python | O(n) | O(n) | Hard | Tricky | |
| 0179 | Largest Number | C++ Python | O(nlogn) | O(1) | Medium | ||
| 0218 | The Skyline Problem | C++ Python | O(nlogn) | O(n) | Hard | Sort, BST | |
| 0252 | Meeting Rooms | C++ Python | O(nlogn) | O(n) | Easy | π | |
| 0253 | Meeting Rooms II | C++ Python | O(nlogn) | O(n) | Medium | π | |
| 0274 | H-Index | C++ Python | O(n) | O(n) | Medium | Counting Sort | |
| 0280 | Wiggle Sort | C++ Python | O(n) | O(1) | Medium | π | |
| 0324 | Wiggle Sort II | C++ Python | O(n) on average | O(1) | Medium | variant of Sort Colors | Quick Select, Tri Partition |
| 0347 | Top K Frequent Elements | C++ Python | O(n) | O(n) | Medium | Quick Select, Heap, Bucket Sort | |
| 0406 | Queue Reconstruction by Height | C++ Python | O(n * sqrt(n)) | O(n) | Medium | Tricky | |
| 0451 | Sort Characters By Frequency | C++ Python | O(n) | O(n) | Medium | ||
| 0493 | Reverse Pairs | C++ Python | O(nlogn) | O(n) | Hard | Sort | |
| 0692 | Top K Frequent Words | C++ Python | O(n + klogk) on average | O(n) | Medium | Quick Select, Heap, Bucket Sort | |
| 0912 | Sort an Array | C++ Python | O(nlogn) | O(n) | Medium | Merge Sort, Quick Sort | |
| 0937 | Reorder Log Files | C++ Python | O(nlogn * l) | O(l) | Easy | ||
| 0969 | Pancake Sorting | C++ Python | O(nlogn) | O(n) | Medium | variant of Count of Smaller Numbers After Self | BIT, Fenwick Tree, Merge Sort |
| 0973 | K Closest Points to Origin | C++ Python | O(n) on average | O(1) | Easy | Quick Select, Heap | |
| 0976 | Largest Perimeter Triangle | C++ Python | O(nlogn) | O(1) | Easy |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0015 | 3 Sum | C++ Python | O(n^2) | O(1) | Medium | Two Pointers | |
| 0016 | 3 Sum Closest | C++ Python | O(n^2) | O(1) | Medium | Two Pointers | |
| 0018 | 4 Sum | C++ Python | O(n^3) | O(1) | Medium | Two Pointers | |
| 0019 | Remove Nth Node From End of List | C++ Python | O(n) | O(1) | Medium | ||
| 0086 | Partition List | C++ Python | O(n) | O(1) | Medium | ||
| 0141 | Linked List Cycle | C++ Python | O(n) | O(1) | Easy | ||
| 0142 | Linked List Cycle II | C++ Python | O(n) | O(1) | Medium | ||
| 0143 | Reorder List | C++ Python | O(n) | O(1) | Medium | ||
| 0167 | Two Sum II - Input array is sorted | C++ Python | O(n) | O(1) | Medium | ||
| 0209 | Minimum Size Subarray Sum | C++ Python | O(n) | O(1) | Medium | Binary Search, Sliding Window | |
| 0259 | 3Sum Smaller | C++ Python | O(n^2) | O(1) | Medium | π, LintCode | |
| 0283 | Move Zeroes | C++ Python | O(n) | O(1) | Easy | ||
| 0287 | Find the Duplicate Number | C++ Python | O(n) | O(1) | Hard | Binary Search, Two Pointers | |
| 0344 | Reverse String | C++ Python | O(n) | O(1) | Easy | ||
| 0345 | Reverse Vowels of a String | C++ Python | O(n) | O(1) | Easy | ||
| 0349 | Intersection of Two Arrays | C++ Python | O(m + n) | O(min(m, n)) | Easy | EPI | Hash, Binary Search |
| 0350 | Intersection of Two Arrays II | C++ Python | O(m + n) | O(1) | Easy | EPI | Hash, Binary Search |
| 0360 | Sort Transformed Array | C++ Python | O(n) | O(1) | Medium | π | |
| 0424 | Longest Repeating Character Replacement | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
| 0457 | Circular Array Loop | C++ Python | O(n) | O(1) | Medium | ||
| 0567 | Permutation in String | C++ Python | O(n) | O(1) | Medium | ||
| 0611 | Valid Triangle Number | C++ Python | O(n^2) | O(1) | Medium | ||
| 0777 | Swap Adjacent in LR String | C++ Python | O(n) | O(1) | Medium | ||
| 0826 | Most Profit Assigning Work | C++ Python | O(mlogm + nlogn) | O(n) | Medium | ||
| 0828 | Count Unique Characters of All Substrings of a Given String | C++ Python | O(n) | O(1) | Hard | ||
| 0844 | Backspace String Compare | C++ Python | O(m + n) | O(1) | Easy | ||
| 0862 | Shortest Subarray with Sum at Least K | C++ Python | O(n) | O(n) | Hard | Mono Deque, Sliding Window | |
| 0876 | Middle of the Linked List | C++ Python | O(n) | O(1) | Easy | ||
| 0904 | Fruit Into Baskets | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
| 0930 | Binary Subarrays With Sum | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
| 0977 | Squares of a Sorted Array | C++ Python | O(n) | O(1) | Easy | ||
| 0992 | Subarrays with K Different Integers | C++ Python | O(n) | O(k) | Hard | Two Pointers, Sliding Window |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0004 | Median of Two Sorted Arrays | C++ Python | O(log(min(m, n))) | O(1) | Hard | ||
| 0033 | Search in Rotated Sorted Array | C++ Python | O(logn) | O(1) | Medium | CTCI | |
| 0034 | Find First and Last Position of Element in Sorted Array | C++ Python | O(logn) | O(1) | Medium | ||
| 0035 | Search Insert Position | C++ Python | O(logn) | O(1) | Medium | ||
| 0069 | Sqrt(x) | C++ Python | O(logn) | O(1) | Medium | ||
| 0074 | Search a 2D Matrix | C++ Python | O(logm + logn) | O(1) | Medium | ||
| 0081 | Search in Rotated Sorted Array II | C++ Python | O(logn) ~ O(n) | O(1) | Medium | CTCI | |
| 0153 | Find Minimum in Rotated Sorted Array | C++ Python | O(logn) | O(1) | Medium | ||
| 0154 | Find Minimum in Rotated Sorted Array II | C++ Python | O(logn) ~ O(n) | O(1) | Hard | ||
| 0162 | Find Peak Element | C++ Python | O(logn) | O(1) | Medium | ||
| 0222 | Count Complete Tree Nodes | C++ Python | O((logn)^2) | O(1) | Medium | ||
| 0275 | H-Index II | C++ Python | O(logn) | O(1) | Medium | Binary Search | |
| 0278 | First Bad Version | C++ Python | O(logn) | O(1) | Easy | LintCode | |
| 0300 | Longest Increasing Subsequence | C++ Python | O(nlogn) | O(n) | Medium | CTCI, LintCode | Binary Search, BIT, Fenwick Tree, Segment Tree, DP |
| 0302 | Smallest Rectangle Enclosing Black Pixels | C++ Python | O(nlogn) | O(1) | Hard | π | |
| 0354 | Russian Doll Envelopes | C++ Python | O(nlogn) | O(1) | Hard | ||
| 0363 | Max Sum of Rectangle No Larger Than K | C++ Python | O(min(m, n)^2 * max(m, n) * logn(max(m, n))) | O(max(m, n)) | Hard | ||
| 0367 | Valid Perfect Square | C++ Python | O(logn) | O(1) | Medium | ||
| 0374 | Guess Number Higher or Lower | C++ Python | O(logn) | O(1) | Easy | ||
| 0410 | Split Array Largest Sum | C++ Python | O(nlogs) | O(1) | Hard | ||
| 0436 | Find Right Interval | C++ Python | O(nlogn) | O(n) | Medium | ||
| 0475 | Heaters | C++ Python | O((m + n) * logn) | O(1) | Easy | ||
| 0540 | Single Element in a Sorted Array | C++ Python | O(logn) | O(1) | Medium | ||
| 0658 | Find K Closest Elements | C++ Python | O(logn + k) | O(1) | Medium | ||
| 0668 | Kth Smallest Number in Multiplication Table | C++ Python | O(m * log(m * n)) | O(1) | Hard | ||
| 0702 | Search in a Sorted Array of Unknown Size | C++ Python | O(logn) | O(1) | Medium | π | Binary Search |
| 0704 | Binary Search | C++ Python | O(logn) | O(1) | Easy | Binary Search | |
| 0710 | Random Pick with Blacklist | C++ Python | ctor: O(b) pick: O(1) |
O(b) | Hard | ||
| 0719 | Find K-th Smallest Pair Distance | C++ Python | O(nlogn + nlogw) | O(1) | Hard | ||
| 0744 | Find Smallest Letter Greater Than Target | C++ Python | O(logn) | O(1) | Easy | ||
| 0774 | Minimize Max Distance to Gas Station | C++ Python | O(nlogr) | O(1) | Hard | ||
| 0786 | K-th Smallest Prime Fraction | C++ Python | O(nlogr) | O(1) | Hard | ||
| 0793 | Preimage Size of Factorial Zeroes Function | C++ Python | O((logn)^2) | O(1) | Hard | ||
| 0852 | Peak Index in a Mountain Array | C++ Python | O(logn) | O(1) | Easy | ||
| 0875 | Koko Eating Bananas | C++ Python | O(nlogr) | O(1) | Medium | ||
| 0878 | Nth Magical Number | C++ Python | O(logn) | O(1) | Hard | ||
| 0894 | All Possible Full Binary Trees | C++ Python | O(n * 4^n / n^(3/2)) | O(n * 4^n / n^(3/2)) | Medium | ||
| 0911 | Online Election | C++ Python | ctor: O(n) query : O(logn) |
O(n) | Medium | ||
| 0981 | Time Based Key-Value Store | C++ Python | set: O(1) get : O(logn) |
O(n) | Medium |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0220 | Contains Duplicate III | C++ Python | O(nlogk) | O(k) | Medium | ||
| 0230 | Kth Smallest Element in a BST | C++ Python | O(max(h, k)) | O(min(h, k)) | Medium | ||
| 0235 | Lowest Common Ancestor of a Binary Search Tree | C++ Python | O(h) | O(1) | Easy | EPI | |
| 0270 | Closest Binary Search Tree Value | C++ Python | O(h) | O(1) | Easy | π | |
| 0285 | Inorder Successor in BST | C++ Python | O(h) | O(1) | Medium | π | |
| 0352 | Data Stream as Disjoint Intervals | C++ Python | O(logn) | O(n) | Hard | ||
| 0449 | Serialize and Deserialize BST | C++ Python | O(n) | O(h) | Medium | ||
| 0450 | Delete Node in a BST | C++ Python | O(h) | O(h) | Medium | ||
| 0530 | Minimum Absolute Difference in BST | C++ Python | O(n) | O(h) | Easy | ||
| 0776 | Split BST | C++ Python | O(n) | O(h) | Medium | π | |
| 0783 | Minimum Distance Between BST Nodes | C++ Python | O(n) | O(h) | Easy | ||
| 0510 | Inorder Successor in BST II | C++ Python | O(h) | O(1) | Medium | π |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0102 | Binary Tree Level Order Traversal | C++ Python | O(n) | O(n) | Easy | ||
| 0107 | Binary Tree Level Order Traversal II | C++ Python | O(n) | O(n) | Easy | ||
| 0103 | Binary Tree Zigzag Level Order Traversal | Python | O(n) | O(n) | Medium | ||
| 0117 | Populating Next Right Pointers in Each Node II | Python | O(n) | O(1) | Hard | ||
| 0127 | Word Ladder | C++ Python | O(b^(d/2)) | O(w * l) | Medium | CTCI | Bi-BFS |
| 0130 | Surrounded Regions | C++ Python | O(m * n) | O(m + n) | Medium | ||
| 0133 | Clone Graph | Python | O(n) | O(n) | Medium | ||
| 0207 | Course Schedule | C++ Python | O(|V| + |E|) | O(|E|) | Medium | Topological Sort, Kahnβs Algorithm |
|
| 0210 | Course Schedule II | C++ Python | O(|V| + |E|) | O(|E|) | Medium | Topological Sort, Kahnβs Algorithm |
|
| 0261 | Graph Valid Tree | C++ Python | O(|V| + |E|) | O(|V| + |E|) | Medium | π | |
| 0269 | Alien Dictionary | C++ Python | O(n) | O(1) | Hard | π | Topological Sort, BFS, DFS |
| 0286 | Walls and Gates | C++ Python | O(m * n) | O(g) | Medium | π | |
| 0310 | Minimum Height Trees | C++ Python | O(n) | O(n) | Medium | ||
| 0317 | Shortest Distance from All Buildings | C++ Python | O(k * m * n) | O(m * n) | Hard | π | |
| 0433 | Minimum Genetic Mutation | C++ Python | O(n * b) | O(b) | Medium | ||
| 0444 | Sequence Reconstruction | C++ Python | O(n * s) | O(n) | Medium | π | Topological Sort |
| 0490 | The Maze | C++ Python | O(max(r, c) * w) | O(w) | Medium | ||
| 0499 | The Maze III | C++ Python | O(max(r, c) * wlogw) | O(w^2) | Hard | ||
| 0505 | The Maze II | C++ Python | O(max(r, c) * wlogw) | O(w) | Medium | ||
| 0542 | 01 Matrix | C++ Python | O(m * n) | O(1) | Medium | DP | |
| 0666 | Path Sum IV | C++ Python | O(n) | O(w) | Medium | π | Topological Sort |
| 0675 | Cut Off Trees for Golf Event | C++ Python | O(t * m * n) | O(m * n) | Hard | A* Search Algorithm |
|
| 0742 | Closest Leaf in a Binary Tree | C++ Python | O(n) | O(n) | Medium | ||
| 0743 | Network Delay Time | C++ Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's Algorithm |
|
| 0752 | Open the Lock | C++ Python | O(k * n^k + d) | O(k * n^k + d) | Medium | ||
| 0773 | Sliding Puzzle | C++ Python | O((m * n) * (m * n)!) | O((m * n) * (m * n)!) | Hard | A* Search Algorithm |
|
| 0787 | Cheapest Flights Within K Stops | C++ Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's Algorithm |
|
| 0815 | Bus Routes | C++ Python | O(|E| + |V|) | O(|E| + |V|) | Hard | ||
| 0854 | K-Similar Strings | C++ Python | O(n * n!/(c_a!*...*c_z!)) | O(n * n!/(c_a!*...*c_z!)) | Hard | ||
| 0864 | Shortest Path to Get All Keys | C++ Python | O(k * r * c + k^3*2^k) | O(k*2^k) | Hard | Dijkstra's Algorithm |
|
| 0882 | Reachable Nodes In Subdivided Graph | C++ Python | O(|E| * log|V|) | O(|E|) | Hard | Dijkstra's Algorithm |
|
| 0886 | Possible Bipartition | C++ Python | O(|V| + |E|) | O(|V| + |E|) | Medium | ||
| 0913 | Cat and Mouse | C++ Python | O(n^3) | O(n^2) | Hard | MiniMax, Topological Sort | |
| 0934 | Shortest Bridge | C++ Python | O(n^2) | O(n^2) | Medium | BFS, DFS | |
| 0967 | Numbers With Same Consecutive Differences | C++ Python | O(2^n) | O(2^n) | Medium | ||
| 0994 | Rotting Oranges | C++ Python | O(m * n) | O(m * n) | Easy |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0112 | Path Sum | Python | O(n) | O(h) | Easy | ||
| 0113 | Path Sum II | Python | O(n) | O(h) | Medium | ||
| 0199 | Binary Tree Right Side View | Python | O(n) | O(h) | Medium | ||
| 0200 | Number of Islands | C++ Python | O(m * n) | O(m * n) | Medium | BFS, DFS, Union Find | |
| 0236 | Lowest Common Ancestor of a Binary Tree | C++ Python | O(n) | O(h) | Medium | EPI | |
| 0247 | Strobogrammatic Number II | C++ Python | O(n * 5^(n/2)) | O(n) | Medium | π | |
| 0250 | Count Univalue Subtrees | C++ Python | O(n) | O(h) | Medium | π | |
| 0257 | Binary Tree Paths | C++ Python | O(n * h) | O(h) | Easy | ||
| 0282 | Expression Add Operators | C++ Python | O(4^n) | O(n) | Hard | ||
| 0301 | Remove Invalid Parentheses | C++ Python | O(C(n, c)) | O(c) | Hard | ||
| 0329 | Longest Increasing Path in a Matrix | C++ Python | O(m * n) | O(m * n) | Hard | DFS, Topological Sort | |
| 0339 | Nested List Weight Sum | C++ Python | O(n) | O(h) | Easy | π | |
| 0364 | Nested List Weight Sum II | C++ Python | O(n) | O(h) | Medium | π | |
| 0366 | Find Leaves of Binary Tree | C++ Python | O(n) | O(h) | Medium | π | |
| 0417 | Pacific Atlantic Water Flow | C++ Python | O(m * n) | O(m * n) | Medium | ||
| 0440 | K-th Smallest in Lexicographical Order | C++ Python | O(logn) | O(logn) | Hard | ||
| 0464 | Can I Win | C++ Python | O(n!) | O(n) | Medium | ||
| 0515 | Find Largest Value in Each Tree Row | C++ Python | O(n) | O(h) | Medium | ||
| 0547 | Friend Circles | C++ Python | O(n^2) | O(n) | Medium | Union Find | |
| 0582 | Kill Process | C++ Python | O(n) | O(n) | Medium | π | DFS, BFS |
| 0638 | Shopping Offers | C++ Python | O(n * 2^n) | O(n) | Medium | ||
| 0690 | Employee Importance | C++ Python | O(n) | O(h) | Easy | DFS, BFS | |
| 0694 | Number of Distinct Islands | C++ Python | O(m * n) | O(m * n) | Medium | π | |
| 0695 | Max Area of Island | C++ Python | O(m * n) | O(m * n) | Easy | ||
| 0711 | Number of Distinct Islands II | C++ Python | O((m * n) * log(m * n)) | O(m * n) | Hard | π | Hash |
| 0733 | Max Area of Island | C++ Python | O(m * n) | O(m * n) | Easy | ||
| 0749 | Contain Virus | C++ Python | O((m * n)^(4/3)) | O(m * n) | Hard | Simulation | |
| 0753 | Cracking the Safe | C++ Python | O(k^n) | O(k^n) | Hard | de Bruijn sequences, Lyndon word, Rolling Hash, Backtracking, Greedy |
|
| 0756 | Pyramid Transition Matrix | C++ Python | O(a^b) | O(a^b) | Medium | ||
| 0785 | Is Graph Bipartite? | C++ Python | O(|V| + |E|) | O(|V|) | Medium | ||
| 0797 | All Paths From Source to Target | C++ Python | O(p + r * n) | O(n) | Medium | ||
| 0802 | Find Eventual Safe States | C++ Python | O(|V| + |E|) | O(|V|) | Medium | ||
| 0827 | Making A Large Island | C++ Python | O(n^2) | O(n^2) | Hard | ||
| 0834 | Sum of Distances in Tree | C++ Python | O(n) | O(n) | Hard | ||
| 0841 | Keys and Rooms | C++ Python | O(n!) | O(n) | Medium | ||
| 0851 | Loud and Rich | C++ Python | O(q + r) | O(q + r) | Medium |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0017 | Letter Combinations of a Phone Number | C++ Python | O(n * 4^n) | O(1) | Medium | ||
| 0022 | Generate Parentheses | C++ Python | O(4^n / n^(3/2)) | O(n) | Medium | ||
| 0037 | Sudoku Solver | Python | O((9!)^9) | O(1) | Hard | ||
| 0039 | Combination Sum | Python | O(k * n^k) | O(k) | Medium | ||
| 0040 | Combination Sum II | Python | O(k * C(n, k)) | O(k) | Medium | ||
| 0046 | Permutations | Python | O(n * n!) | O(n) | Medium | ||
| 0047 | Permutations II | Python | O(n * n!) | O(n) | Medium | ||
| 0051 | N-Queens | Python | O(n^2 * n!) | O(n) | Hard | ||
| 0052 | N-Queens-II | Python | O(n!) | O(n) | Hard | ||
| 0077 | Combinations | C++ Python | O(O(k * C(n, k))) | O(k) | Medium | ||
| 0079 | Word Search | C++ Python | O(m * n * 3^l) | O(l) | Medium | ||
| 0093 | Restore IP Addresses | Python | O(1) | O(1) | Medium | ||
| 0078 | Subsets | C++ Python | O(n * 2^n) | O(1) | Medium | ||
| 0090 | Subsets II | C++ Python | O(n * 2^n) | O(1) | Medium | ||
| 0126 | Word Ladder II | C++ Python | O(b^(d/2)) | O(w * l) | Hard | CTCI | Bi-BFS |
| 0131 | Palindrome Partitioning | Python | O(n^2) ~ O(2^n) | O(n^2) | Medium | ||
| 0140 | Word Break II | C++ Python | O(n * l^2 + n * r) | O(n^2) | Hard | ||
| 0212 | Word Search II | C++ Python | O(m * n * 3^h) | O(t) | Hard | LintCode | Trie, DFS |
| 0216 | Combination Sum III | C++ Python | O(k * C(n, k)) | O(k) | Medium | ||
| 0254 | Factor Combinations | C++ Python | O(nlogn) | O(logn) | Medium | π | |
| 0267 | Palindrome Permutation II | C++ Python | O(n * n!) | O(n) | Medium | π | |
| 0291 | Word Pattern II | C++ Python | O(n * C(n - 1, c - 1)) | O(n + c) | Hard | π | |
| 0294 | Flip Game II | C++ Python | O(n + c^2) | O(c) | Medium | π | DP, Hash, Sprague-Grundy Theorem |
| 0320 | Generalized Abbreviation | C++ Python | O(n * 2^n) | O(n) | Medium | π | |
| 0425 | Word Squares | C++ Python | O(n^2 * n!) | O(n^2) | Hard | π | |
| 0488 | Zuma Game | C++ Python | O((b+h) * h!*(b+h-1)!/(b-1)!) | O((b+h) * h!*(b+h-1)!/(b-1)!) | Hard | Backtracking | |
| 0491 | Increasing Subsequences | C++ Python | O(n * 2^n) | O(n) | Medium | Backtracking | |
| 0526 | Beautiful Arrangement | C++ Python | O(n!) | O(n) | Medium | ||
| 0676 | Implement Magic Dictionary | C++ Python | O(n) | O(d) | Medium | Trie, DFS | |
| 0679 | 24 Game | C++ Python | O(1) | O(1) | Hard | DFS | |
| 0698 | Partition to K Equal Sum Subsets | C++ Python | O(n * 2^n) | O(2^n) | Medium | DFS, DP, Memoization | |
| 0718 | Maximum Length of Repeated Subarray | C++ Python | O(m * n) | O(min(m, n)) | Medium | DP, Hash, Binary Search | |
| 0784 | Letter Case Permutation | C++ Python | O(n * 2^n) | O(1) | Easy | ||
| 0996 | Number of Squareful Arrays | C++ Python | O(n!) | O(n^2) | Hard |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0010 | Regular Expression Matching | Python | O(m * n) | O(n) | Hard | ||
| 0044 | Wildcard Matching | Python | O(m * n) | O(1) | Hard | Greedy | |
| 0053 | Maximum Subarray | C++ Python | O(n) | O(1) | Easy | ||
| 0062 | Unique Paths | Python | O(m + n) | O(1) | Medium | Combinatorics | |
| 0063 | Unique Paths II | Python | O(m * n) | O(m + n) | Medium | ||
| 0064 | Minimum Path Sum | Python | O(m * n) | O(m + n) | Medium | ||
| 0070 | Climbing Stairs | C++ Python | O(logn) | O(1) | Easy | Matrix Exponentiation | |
| 0072 | Edit Distance | Python | O(m * n) | O(m + n) | Hard | ||
| 0087 | Scramble String | Python | O(n^4) | O(n^3) | Hard | ||
| 0091 | Decode Ways | C++ Python | O(n) | O(1) | Medium | ||
| 0096 | Unique Binary Search Trees | Python | O(n) | O(1) | Medium | Math | |
| 0097 | Interleaving String | Python | O(m * n) | O(m + n) | Hard | ||
| 0115 | Distinct Subsequences | Python | O(n^2) | O(n) | Hard | ||
| 0120 | Triangle | Python | O(m * n) | O(n) | Medium | ||
| 0123 | Best Time to Buy and Sell Stock III | Python | O(n) | O(1) | Hard | ||
| 0132 | Palindrome Partitioning II | Python | O(n^2) | O(n^2) | Hard | ||
| 0139 | Word Break | C++ Python | O(n * l^2) | O(n) | Medium | ||
| 0152 | Maximum Product Subarray | C++ Python | O(n) | O(1) | Medium | ||
| 0174 | Dungeon Game | Python | O(m * n) | O(m + n) | Hard | ||
| 0188 | Best Time to Buy and Sell Stock IV | C++ Python | O(n) | O(n) | Hard | Quick Select, Mono Stack | |
| 0198 | House Robber | C++ Python | O(n) | O(1) | Easy | ||
| 0213 | House Robber II | C++ Python | O(n) | O(1) | Medium | ||
| 0221 | Maximal Square | C++ Python | O(n^2) | O(n) | Medium | EPI | |
| 0256 | Paint House | C++ Python | O(n) | O(1) | Medium | π | |
| 0265 | Paint House II | C++ Python | O(n * k) | O(k) | Hard | π | |
| 0276 | Paint Fence | C++ Python | O(n) | O(1) | Easy | π | |
| 0279 | Perfect Squares | C++ Python | O(n * sqrt(n)) | O(n) | Medium | Hash | |
| 0303 | Range Sum Query - Immutable | C++ Python | ctor: O(n), lookup: O(1) | O(n) | Easy | ||
| 0304 | Range Sum Query 2D - Immutable | C++ Python | ctor: O(m * n), lookup: O(1) | O(m * n) | Medium | ||
| 0309 | Best Time to Buy and Sell Stock with Cooldown | C++ Python | O(n) | O(1) | Medium | ||
| 0312 | Burst Balloons | C++ Python | O(n^3) | O(n^2) | Hard | ||
| 0322 | Coin Change | C++ Python | O(n * k) | O(k) | Medium | ||
| 0351 | Android Unlock Patterns | C++ Python | O(9^2 * 2^9) | O(9 * 2^9) | Medium | π | Backtracking |
| 0357 | Count Numbers with Unique Digits | C++ Python | O(n) | O(1) | Medium | Backtracking, Math | |
| 0361 | Bomb Enemy | C++ Python | O(m * n) | O(m * n) | Medium | π | |
| 0368 | Largest Divisible Subset | C++ Python | O(n^2) | O(n) | Medium | ||
| 0375 | Guess Number Higher or Lower II | C++ Python | O(n^3) | O(n^2) | Medium | ||
| 0377 | Combination Sum IV | C++ Python | O(nlogn + n * t) | O(t) | Medium | ||
| 0403 | Frog Jump | C++ Python | O(n^2) | O(n^2) | Hard | ||
| 0416 | Partition Equal Subset Sum | C++ Python | O(n * s) | O(s) | Medium | ||
| 0418 | Sentence Screen Fitting | C++ Python | O(r + n * c) | O(n) | Medium | π | |
| 0446 | Arithmetic Slices II - Subsequence | C++ Python | O(n^2) | O(n * d) | Hard | ||
| 0465 | Optimal Account Balancing | C++ Python | O(n * 2^n) | O(2^n) | Hard | π | |
| 0466 | Count The Repetitions | C++ Python | O(s1 * min(s2, n1)) | O(s2) | Hard | ||
| 0467 | Unique Substrings in Wraparound String | C++ Python | O(n) | O(1) | Medium | ||
| 0471 | Encode String with Shortest Length | C++ Python | O(n^3) on average | O(n^2) | Medium | π | |
| 0472 | Concatenated Words | C++ Python | O(n * l^2) | O(n * l) | Medium | ||
| 0474 | Ones and Zeroes | C++ Python | O(s * m * n) | O(m * n) | Medium | ||
| 0486 | Predict the Winner | C++ Python | O(n^2) | O(n) | Medium | ||
| 0494 | Target Sum | C++ Python | O(n * S) | O(S) | Medium | DP | |
| 0509 | Fibonacci Number | C++ Python | O(logn) | O(1) | Easy | variant of Climbing Stairs | Matrix Exponentiation |
| 0514 | Freedom Trail | C++ Python | O(k) ~ O(k * r^2) | O(r) | Hard | ||
| 0516 | Longest Palindromic Subsequence | C++ Python | O(n^2) | O(n) | Medium | ||
| 0518 | Coin Change 2 | C++ Python | O(n * m) | O(m) | Medium | DP | |
| 0546 | Remove Boxes | C++ Python | O(n^3) ~ O(n^4) | O(n^3) | Hard | ||
| 0552 | Student Attendance Record II | C++ Python | O(n) | O(1) | Hard | ||
| 0562 | Longest Line of Consecutive One in Matrix | C++ Python | O(m * n) | O(n) | Medium | π | |
| 0568 | Maximum Vacation Days | C++ Python | O(n^2 * k) | O(k) | Hard | π | |
| 0576 | Out of Boundary Paths | C++ Python | O(N * m * n) | O(m * n) | Medium | ||
| 0583 | Delete Operation for Two Strings | C++ Python | O(m * n) | O(n) | Medium | ||
| 0600 | Non-negative Integers without Consecutive Ones | C++ Python | O(1) | O(1) | Hard | ||
| 0629 | K Inverse Pairs Array | C++ Python | O(n * k) | O(k) | Hard | ||
| 0639 | Decode Ways II | C++ Python | O(n) | O(1) | Hard | ||
| 0650 | 2 Keys Keyboard | C++ Python | O(sqrt(n)) | O(1) | Medium | ||
| 0656 | Coin Path | C++ Python | O(n * B) | O(n) | Hard | π | |
| 0664 | Strange Printer | C++ Python | O(n^3) | O(n^2) | Hard | ||
| 0673 | Number of Longest Increasing Subsequence | C++ Python | O(n^2) | O(n) | Medium | ||
| 0688 | Knight Probability in Chessboard | C++ Python | O(k * n^2) | O(n^2) | Medium | ||
| 0689 | Maximum Sum of 3 Non-Overlapping Subarrays | C++ Python | O(n) | O(n) | Hard | ||
| 0691 | Stickers to Spell Word | C++ Python | O(T * S^T) | O(T * S^T) | Hard | Backtracking, Memoization | |
| 0712 | Minimum ASCII Delete Sum for Two Strings | C++ Python | O(m * n) | O(n) | Medium | ||
| 0714 | Best Time to Buy and Sell Stock with Transaction Fee | C++ Python | O(n) | O(1) | Medium | ||
| 0727 | Minimum Window Subsequence | C++ Python | O(s * t) | O(s) | Hard | π | |
| 0730 | Count Different Palindromic Subsequences | C++ Python | O(n^2) | O(n) | Hard | ||
| 0740 | Delete and Earn | C++ Python | O(n) | O(1) | Medium | ||
| 0741 | Cherry Pickup | C++ Python | O(n^3) | O(n^2) | Hard | ||
| 0746 | Min Cost Climbing Stairs | C++ Python | O(n) | O(1) | Easy | ||
| 0750 | Number Of Corner Rectangles | C++ Python | O(n * m^2) | O(n * m) | Medium | ||
| 0764 | Largest Plus Sign | C++ Python | O(n^2) | O(n^2) | Medium | ||
| 0788 | Rotated Digits | C++ Python | O(logn) | O(logn) | Easy | Memoization | |
| 0790 | Domino and Tromino Tiling | C++ Python | O(logn) | O(1) | Medium | Matrix Exponentiation | |
| 0799 | Champagne Tower | C++ Python | O(n^2) | O(n) | Medium | ||
| 0801 | Minimum Swaps To Make Sequences Increasing | C++ Python | O(n) | O(1) | Medium | ||
| 0805 | Split Array With Same Average | C++ Python | O(n^4) | O(n^3) | Hard | ||
| 0808 | Soup Servings | C++ Python | O(1) | O(1) | Medium | Memoization | |
| 0813 | Largest Sum of Averages | C++ Python | O(k * n^2) | O(n) | Medium | ||
| 0818 | Race Car | C++ Python | O(nlogn) | O(n) | Hard | ||
| 0823 | Binary Trees With Factors | C++ Python | O(n^2) | O(n) | Medium | ||
| 0837 | New 21 Game | C++ Python | O(n) | O(n) | Medium | ||
| 0838 | Push Dominoes | C++ Python | O(n) | O(n) | Medium | ||
| 0847 | Shortest Path Visiting All Nodes | C++ Python | O(n *2^n) | O(n * 2^n) | Hard | BFS | |
| 0877 | Stone Game | C++ Python | O(n^2) | O(n) | Medium | variant of Predict the Winner | |
| 0879 | Profitable Schemes | C++ Python | O(n * p * g) | O(p * g) | Hard | ||
| 0903 | Valid Permutations for DI Sequence | C++ Python | O(n^2) | O(n) | Hard | ||
| 0920 | Number of Music Playlists | C++ Python | O(n * l) | O(l) | Hard | ||
| 0926 | Flip String to Monotone Increasing | C++ Python | O(n) | O(1) | Medium | ||
| 0931 | Minimum Falling Path Sum | C++ Python | O(n^2) | O(1) | Medium | ||
| 0935 | Knight Dialer | C++ Python | O(logn) | O(1) | Medium | Matrix Exponentiation | |
| 0940 | Distinct Subsequences II | C++ Python | O(n) | O(1) | Hard | ||
| 0943 | Find the Shortest Superstring | C++ Python | O(n^2 * (l^2 + 2^n)) | O(n^2) | Hard | ||
| 0956 | Tallest Billboard | C++ Python | O(n * 3^(n/2)) | O(3^(n/2)) | Hard | ||
| 0960 | Delete Columns to Make Sorted III | C++ Python | O(n * l^2) | O(l) | Hard | ||
| 0964 | Least Operators to Express Number | C++ Python | O(logn / logx) | O(logn) | Hard | Math | |
| 0975 | Odd Even Jump | C++ Python | O(nlogn) | O(n) | Hard | Mono Stack, BST | |
| 0980 | Unique Paths III | C++ Python | O((m * n) * 2^(m * n)) | O((m * n) * 2^(m * n)) | Hard | ||
| 0983 | Minimum Cost For Tickets | C++ Python | O(n) | O(1) | Medium | ||
| 1000 | Minimum Cost to Merge Stones | C++ Python | O(n^3 / k) | O(n^2) | Hard |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0011 | Container With Most Water | C++ Python | O(n) | O(1) | Medium | ||
| 0042 | Trapping Rain Water | C++ Python | O(n) | O(1) | Hard | Tricky | |
| 0045 | Jump Game II | Python | O(n) | O(1) | Hard | ||
| 0055 | Jump Game | C++ Python | O(n) | O(1) | Medium | ||
| 0122 | Best Time to Buy and Sell Stock II | C++ Python | O(n) | O(1) | Easy | ||
| 0134 | Gas Station | Python | O(n) | O(1) | Medium | ||
| 0135 | Candy | C++ Python | O(n) | O(n) | Hard | ||
| 0316 | Remove Duplicate Letters | C++ Python | O(n) | O(1) | Hard | Mono Stack | |
| 0321 | Create Maximum Number | C++ Python | O(k * (m + n + k)) ~ O(k * (m + n + k^2)) | O(m + n + k^2) | Hard | variant of Delete Digits | Greedy, DP |
| 0330 | Patching Array | C++ Python | O(s + logn) | O(1) | Hard | ||
| 0376 | Wiggle Subsequence | C++ Python | O(n) | O(1) | Medium | ||
| 0392 | Is Subsequence | C++ Python | O(n) | O(1) | Medium | ||
| 0397 | Integer Replacement | C++ Python | O(n) | O(1) | Medium | Math | |
| 0402 | Remove K Digits | C++ Python | O(n) | O(n) | Medium | LintCode | |
| 0435 | Non-overlapping Intervals | C++ Python | O(nlogn) | O(1) | Medium | Line Sweep | |
| 0452 | Minimum Number of Arrows to Burst Balloons | C++ Python | O(nlogn) | O(1) | Medium | ||
| 0455 | Assign Cookies | C++ Python | O(nlogn) | O(1) | Easy | ||
| 0484 | Find Permutation | C++ Python | O(n) | O(1) | Medium | π | |
| 0621 | Task Scheduler | C++ Python | O(n) | O(1) | Medium | ||
| 0630 | Course Schedule III | C++ Python | O(nlogn) | O(k) | Hard | ||
| 0646 | Maximum Length of Pair Chain | C++ Python | O(nlogn) | O(1) | Medium | variant of Non-overlapping Intervals | Line Sweep |
| 0649 | Dota2 Senate | C++ Python | O(n) | O(n) | Medium | ||
| 0659 | Split Array into Consecutive Subsequences | C++ Python | O(n) | O(1) | Medium | ||
| 0738 | Monotone Increasing Digits | C++ Python | O(1) | O(1) | Medium | ||
| 0757 | Set Intersection Size At Least Two | C++ Python | O(nlogn) | O(n) | Hard | ||
| 0759 | Employee Free Time | C++ Python | O(m * logn) | O(n) | Hard | π | |
| 0763 | Partition Labels | C++ Python | O(n) | O(n) | Medium | ||
| 0767 | Reorganize String | C++ Python | O(n) | O(1) | Medium | ||
| 0798 | Smallest Rotation with Highest Score | C++ Python | O(n) | O(1) | Hard | ||
| 0843 | Guess the Word | C++ Python | O(n) | O(n) | Hard | MinMax, Math | |
| 0861 | Score After Flipping Matrix | C++ Python | O(r * c) | O(1) | Medium | ||
| 0870 | Advantage Shuffle | C++ Python | O(nlogn) | O(n) | Medium | ||
| 0881 | Boats to Save People | C++ Python | O(nlogn) | O(n) | Medium | ||
| 0936 | Stamping The Sequence | C++ Python | O((n - m) * m) | O((n - m) * m) | Hard | ||
| 0948 | Bag of Tokens | C++ Python | O(nlogn) | O(1) | Medium | Two Pointers | |
| 0962 | Maximum Width Ramp | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
| 0968 | Binary Tree Cameras | C++ Python | O(n) | O(h) | Hard | DFS | |
| 0984 | String Without AAA or BBB | C++ Python | O(a + b) | O(1) | Easy | ||
| 0991 | Broken Calculator | C++ Python | O(logn) | O(1) | Medium | ||
| 0995 | Minimum Number of K Consecutive Bit Flips | C++ Python | O(n) | O(1) | Hard |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0332 | Reconstruct Itinerary | C++ Python | O(|V| + |E|log|V|) | O(|V| + |E|) | Medium | Hierholzer's Algorithm, Eulerian Path |
|
| 0399 | Evaluate Division | C++ Python | O(e + q) | O(n) | Medium | Floyd-Warshall Algorithm, BFS, Union Find |
|
| 0765 | Couples Holding Hands | C++ Python | O(n) | O(n) | Hard | ||
| 0924 | Minimize Malware Spread | C++ Python | O(n^2) | O(n) | Hard | Union Find | |
| 0928 | Minimize Malware Spread II | C++ Python | O(n^2) | O(n) | Hard | Union Find | |
| 0959 | Regions Cut By Slashes | C++ Python | O(n^2) | O(n^2) | Medium | Union Find | |
| 0990 | Satisfiability of Equality Equations | C++ Python | O(n) | O(1) | Medium | Union Find |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0587 | Erect the Fence | C++ Python | O(nlogn) | O(n) | Hard | Convex Hull, Monotone Chain |
|
| 0892 | Surface Area of 3D Shapes | C++ Python | O(n^2) | O(1) | Easy |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0874 | Walking Robot Simulation | C++ Python | O(n + k) | O(k) | Easy |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0146 | LRU Cache | C++ Python | O(1) | O(k) | Hard | OrderedDict | |
| 0225 | Implement Stack using Queues | C++ Python | push: O(n), pop: O(1), top: O(1) | O(n) | Easy | ||
| 0173 | Binary Search Tree Iterator | C++ Python | O(1), amortized | O(h) | Medium | ||
| 0284 | Peeking Iterator | C++ Python | O(1) | O(1) | Medium | ||
| 0348 | Design Tic-Tac-Toe | C++ Python | O(1) | O(n^2) | Medium | π | |
| 0353 | Design Snake Game | C++ Python | O(1) | O(s) | Medium | π | Deque |
| 0355 | Design Twitter | C++ Python | O(u + klogk) | O(t + f) | Medium | LintCode | Heap |
| 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) | C++ Python | O(1) | O(n) | Hard | ||
| 0381 | Insert Delete GetRandom O(1) - Duplicates allowed | C++ Python | O(1) | O(n) | Hard | ||
| 0432 | All O`one Data Structure | C++ Python | O(1) | O(n) | Hard | ||
| 0460 | LFU Cache | C++ Python | O(1) | O(k) | Hard | ||
| 0489 | Robot Room Cleaner | C++ Python | O(n) | O(n) | Hard | π | |
| 0535 | Encode and Decode TinyURL | C++ Python | O(1) | O(n) | Medium | ||
| 0588 | 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 | π | |
| 0604 | Design Compressed String Iterator | C++ Python | O(1) | O(1) | Easy | π | |
| 0622 | Design Circular Queue | C++ Python | O(1) | O(k) | Medium | Design | |
| 0631 | Design Excel Sum Formula | C++ Python | set: O((r * c)^2) get: O(1) sum: O((r * c)^2) |
O(r * c) | Hard | π | |
| 0635 | Design Log Storage System | C++ Python | put: O(1) retrieve: O(n + dlogd) |
O(n) | Medium | π | |
| 0641 | Design Circular Deque | C++ Python | O(1) | O(1) | Medium | Design | |
| 0642 | Design Search Autocomplete System | C++ Python | O(p^2) | O(p * t + s) | Hard | π | |
| 0705 | Design HashSet | C++ Python | O(1) | O(n) | Easy | Design | |
| 0706 | Design HashMap | C++ Python | O(1) | O(n) | Easy | Design | |
| 0707 | Design Linked List | C++ Python | O(n) | O(n) | Medium | Design | |
| 0715 | Range Module | C++ Python | add: O(n) remove: O(n) query: O(logn) |
O(n) | Hard | ||
| 0716 | Max Stack | C++ Python | push: O(logn) pop: O(logn) popMax: O(logn) top: O(1) peekMax: O(1) |
O(n) | Easy | ||
| 0745 | Prefix and Suffix Search | C++ Python | ctor: O(w * l^2) search : O(p + s) |
O(t) | Hard | Trie | |
| 0900 | RLE Iterator | C++ Python | O(n) | O(1) | Medium |
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|
| # | Title | Solution | Time | Space | Difficulty | Tag | Note |
|---|---|---|---|---|---|---|---|
| 0175 | Combine Two Tables | MySQL | O(m + n) | O(m + n) | Easy | ||
| 0176 | Second Highest Salary | MySQL | O(n) | O(1) | Easy | ||
| 0177 | Nth Highest Salary | MySQL | O(n^2) | O(n) | Medium | ||
| 0178 | Rank Scores | MySQL | O(n^2) | O(n) | Medium | ||
| 0180 | Consecutive Numbers | MySQL | O(n) | O(n) | Medium | ||
| 0181 | Employees Earning More Than Their Managers | MySQL | O(n^2) | O(1) | Easy | ||
| 0182 | Duplicate Emails | MySQL | O(n^2) | O(n) | Easy | ||
| 0183 | Customers Who Never Order | MySQL | O(n^2) | O(1) | Easy | ||
| 0184 | Department Highest Salary | MySQL | O(n^2) | O(n) | Medium | ||
| 0185 | Department Top Three Salaries | MySQL | O(n^2) | O(n) | Hard | ||
| 0196 | Delete Duplicate Emails | MySQL | O(n^2) | O(n) | Easy | ||
| 0197 | Rising Temperature | MySQL | O(n^2) | O(n) | Easy | ||
| 0262 | Trips and Users | MySQL | O((t * u) + tlogt) | O(t) | Hard | ||
| 0511 | Game Play Analysis I | MySQL | O(n) | O(n) | Easy | π | |
| 0512 | Game Play Analysis II | MySQL | O(n) | O(n) | Easy | π | |
| 0534 | Game Play Analysis III | MySQL | O(nlogn) | O(n) | Medium | π | |
| 0550 | Game Play Analysis IV | MySQL | O(n) | O(n) | Medium | π | |
| 0569 | Median Employee Salary | MySQL | O(nlogn) | O(n) | Hard | π | |
| 0570 | Managers with at Least 5 Direct Reports | MySQL | O(n) | O(n) | Medium | π | |
| 0571 | Find Median Given Frequency of Numbers | MySQL | O(nlogn) | O(n) | Hard | π | |
| 0574 | Winning Candidate | MySQL | O(nlogn) | O(n) | Medium | π | |
| 0577 | Employee Bonus | MySQL | O(n) | O(n) | Easy | π | |
| 0578 | Get Highest Answer Rate Question | MySQL | O(nlogn) | O(n) | Medium | π | |
| 0579 | Find Cumulative Salary of an Employee | MySQL | O(n^2) | O(n) | Hard | π | |
| 0580 | Count Student Number in Departments | MySQL | O(s + dlogd) | O(s + d) | Medium | π | |
| 0584 | Find Customer Referee | MySQL | O(n) | O(1) | Easy | π | |
| 0585 | Investments in 2016 | MySQL | O(n^2) | O(n) | Medium | π | |
| 0586 | Customer Placing the Largest Number of Orders | MySQL | O(n) | O(n) | Easy | π | |
| 0595 | Big Countries | MySQL | O(n) | O(1) | Easy | ||
| 0596 | Classes More Than 5 Students | MySQL | O(n) | O(n) | Easy | ||
| 0597 | Friend Requests I: Overall Acceptance Rate | MySQL | O(rlogr + aloga) | O(r + a) | Easy | π | |
| 0601 | Human Traffic of Stadium | MySQL | O(n^3) | O(n^3) | Hard | ||
| 0602 | Friend Requests II: Who Has the Most Friends | MySQL | O(nlogn) | O(n) | Medium | π | |
| 0603 | Consecutive Available Seats | MySQL | O(nlogn) | O(n) | Easy | π | Window Function |
| 0607 | Sales Person | MySQL | O(s * o) | O(s + o) | Easy | π | |
| 0608 | Tree Node | MySQL | O(n^2) | O(n) | Medium | π | |
| 0610 | Triangle Judgement | MySQL | O(n) | O(1) | Easy | π | |
| 0612 | Shortest Distance in a Plane | MySQL | O(n^2) | O(n^2) | Medium | π | |
| 0613 | Shortest Distance in a Line | MySQL | O(nlogn) | O(n) | Easy | π | |
| 0614 | Second Degree Follower | MySQL | O(nlogn) | O(n) | Medium | π | |
| 0615 | Average Salary: Departments VS Company | MySQL | O(nlogn) | O(n) | Hard | π | |
| 0618 | Students Report By Geography | MySQL | O(nlogn) | O(n) | Hard | π | |
| 0619 | Biggest Single Number | MySQL | O(n) | O(n) | Easy | π | |
| 0620 | Not Boring Movies | MySQL | O(nlogn) | O(1) | Easy | ||
| 0626 | Exchange Seats | MySQL | O(nlogn) | O(n) | Medium | ||
| 0627 | Swap Salary | MySQL | O(n) | O(1) | Easy |
| # | 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 |