- 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 repository.
- For more challenging problem solutions, you can also see my GoogleCodeJam, FacebookHackerCup 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
- C++
- Python
- Algorithms
- Math
- Visualization
- Handy Table
- Thinking Techniques as follows:
n | Complexity | Possible Algorithms & Techniques |
---|---|---|
1018+ | O(1) | Math |
1018 | O(logn) | Binary & Ternary Search / Matrix Power / Cycle Tricks / Big Simulation Steps / Values Reranking / Math |
1016 | O(n1/2) | Math |
108 | O(n) | Greedy / Ad-hoc / DP |
4Γ107 | O(nlogn) | Linear # Calls to Binary & Ternary Search / Pre-processing & Querying / Divide and Conquer |
104 | O(n2) | Ad-hoc / DP / Greedy / Divide and Conquer / Branch and Bound |
500 | O(n3) | Ad-hoc / DP / Greedy / Divide and Conquer / Branch and Bound |
90 | O(n4) | Ad-hoc / DP / Greedy / Divide and Conquer / Branch and Bound |
50 | O(n5) | Branch and Bound |
40 | O(nx2n/2) | Meet in the Middle |
20 | O(nΓ2n) | Backtracking / Generating 2n Subsets / Bitmask Technique |
11 | O(n!) | Factorial / Permutation / Combination Algorithm |
# | 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 | doneπ | |
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 | ||
1424 | Diagonal Traverse II | C++ Python | O(m * n) | O(m) | Medium | done, go back | |
1438 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | C++ Python | O(n) | O(n) | Hard | Mono Deque | |
1499 | Max Value of Equation | C++ Python | O(n) | O(n) | Hard | Mono Deque | |
1696 | Jump Game VI | C++ Python | O(n) | O(k) | Medium | Mono Deque, Sliding Window |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
0264 | Ugly Number II | C++ Python | O(n) | O(1) | Medium | done, go back 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 | done, go back | BST, Heap |
0358 | Rearrange String k Distance Apart | C++ Python | O(n) | O(n) | 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 | |
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 | |
1046 | Last Stone Weight | C++ Python | O(nlogn) | O(n) | Easy | ||
1057 | Campus Bikes | C++ Python | O((w * b) * log(w * b)) | O(w * b) | Medium | π | |
1383 | Maximum Performance of a Team | C++ Python | O(nlogn) | O(n) | Hard | variant of Minimum Cost to Hire K Workers | Sort |
1439 | Find the Kth Smallest Sum of a Matrix With Sorted Rows | C++ Python | O(m * klogk) | O(k) | Hard | Binary Search | |
1606 | Find Servers That Handled Most Number of Requests | C++ Python | O(nlogk) | O(k) | Hard | SortedList | |
1642 | Furthest Building You Can Reach | C++ Python | O(nlogk) | O(k) | Medium | ||
1675 | Minimize Deviation in Array | C++ Python | O((n * log(max_num)) * logn) | O(n) | Hard | ||
1792 | Maximum Average Pass Ratio | C++ Python | O(n + mlogn) | O(n) | Medium | ||
1882 | Process Tasks Using Servers | C++ Python | O(n + mlogn) | O(n) | Medium |
# | 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 | done, go back tri quick sort | 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 | done, guard ptrs | |
0148 | Sort List | C++ Python | O(nlogn) | O(logn) | Medium | done, merge sort, go back | |
0164 | Maximum Gap | C++ Python | O(n) | O(n) | Hard | Tricky | |
0179 | Largest Number | C++ Python | O(nlogn) | O(1) | Medium | done, go back, sort with key | |
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 | done heapq go backπ | |
0274 | H-Index | C++ Python | O(n) | O(n) | Medium | done, go back | Counting Sort |
0280 | Wiggle Sort | C++ Python | O(n) | O(1) | Medium | doneπ | |
0324 | Wiggle Sort II | C++ Python | O(n) on average | O(1) | Medium | variant of Sort Colors | 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 | ||
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 | ||
1054 | Distant Barcodes | C++ Python | O(klogk) | O(k) | Medium | variant of Rearrange String k Distance Apart | |
1086 | High Five | C++ Python | O(nlogn) | O(n) | Easy | π | |
1094 | Car Pooling | C++ Python | O(nlogn) | O(n) | Medium | variant of Meeting Rooms II | |
1122 | Relative Sort Array | C++ Python | O(nlogn) | O(n) | Easy | ||
1229 | Meeting Scheduler | C++ Python | O(nlogn) | O(n) | Medium | Line Sweep, Heap | |
1356 | Sort Integers by The Number of 1 Bits | C++ Python | O(nlogn) | O(1) | Easy | Bit Manipulation | |
1365 | How Many Numbers Are Smaller Than the Current Number | C++ Python | O(n + m) | O(m) | Easy | Counting Sort | |
1366 | Rank Teams by Votes | C++ Python | O(m * (n + mlogm)) | O(m^2) | Medium | ||
1451 | Rearrange Words in a Sentence | C++ Python | O(nlogn) | O(n) | Medium | String | |
1481 | Least Number of Unique Integers after K Removals | C++ Python | O(n) | O(n) | Medium | Counting Sort | |
1509 | Minimum Difference Between Largest and Smallest Value in Three Moves | C++ Python | O(n + klogk) | O(1) | Medium | Quick Select | |
1523 | Count Odd Numbers in an Interval Range | C++ Python | O(1) | O(1) | Easy | ||
1561 | Maximum Number of Coins You Can Get | C++ Python | O(nlogn) | O(1) | Medium | ||
1588 | Sum of All Odd Length Subarrays | C++ Python | O(n) | O(1) | Easy | ||
1608 | Special Array With X Elements Greater Than or Equal X | C++ Python | O(n) | O(1) | Easy | variant of H-Index | Counting Sort, Binary Search |
1620 | Coordinate With Maximum Network Quality | C++ Python | O(n^2) | O(1) | Medium | ||
1621 | Number of Sets of K Non-Overlapping Line Segments | C++ Python | O(1) | O(n) | Medium | Binomial Coefficients, Euler's Theorem |
|
1630 | Arithmetic Subarrays | C++ Python | O(n * q) | O(n) | Medium | Arithmetic Series | |
1636 | Sort Array by Increasing Frequency | C++ Python | O(nlogn) | O(n) | Easy | ||
1637 | Widest Vertical Area Between Two Points Containing No Points | C++ Python | O(nlogn) | O(n) | Medium | ||
1680 | Concatenation of Consecutive Binary Numbers | C++ Python | O(n) | O(1) | Medium | ||
1685 | Sum of Absolute Differences in a Sorted Array | C++ Python | O(n) | O(1) | Medium | ||
1688 | Count of Matches in Tournament | C++ Python | O(1) | O(1) | Easy | ||
1703 | Minimum Adjacent Swaps for K Consecutive Ones | C++ Python | O(n) | O(n) | Hard | Prefix Sum | |
1716 | Calculate Money in Leetcode Bank | C++ Python | O(1) | O(1) | Easy | Arithmetic Sequence | |
1772 | Sort Features by Popularity | C++ Python | O(n) | O(1) | Medium | π | |
1847 | Closest Room | C++ Python | O(nlogn + klogk + klogn) | O(n + k) | Hard | Sort, Binary Search | |
1851 | Minimum Interval to Include Each Query | C++ Python | O(nlogn + klogk + klogn) | O(n + k) | Hard | Sort, Heap, Line Sweep | |
1859 | Sorting the Sentence | C++ Python | O(n) | O(n) | Easy | Sort, String |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
0015 | 3 Sum | C++ Python | O(n^2) | O(logn)(from sort) | Medium | done, go back | Two Pointers |
0016 | 3 Sum Closest | C++ Python | O(n^2) | O(logn) from sort | Medium | done | Two Pointers |
0018 | 4 Sum | C++ Python | O(n^3) | O(1) | Medium | done, go back, kSum | Two Pointers |
0019 | Remove Nth Node From End of List | C++ Python | O(n) | O(1) | Medium | done | |
0086 | Partition List | C++ Python | O(n) | O(1) | Medium | done | |
0141 | Linked List Cycle | C++ Python | O(n) | O(1) | Easy | ||
0142 | Linked List Cycle II | C++ Python | O(n) | O(1) | Medium | done, go back, turtle-rabbit | |
0143 | Reorder List | C++ Python | O(n) | O(1) | Medium | done, go back, many basic concepts | |
0167 | Two Sum II - Input array is sorted | C++ Python | O(n) | O(1) | Medium | done | |
0209 | Minimum Size Subarray Sum | C++ Python | O(n) | O(1) | Medium | done | Binary Search, Sliding Window |
0259 | 3Sum Smaller | C++ Python | O(n^2) | O(1) | Medium | done π, 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 | |
1004 | Max Consecutive Ones III | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
1033 | Moving Stones Until Consecutive | C++ Python | O(1) | O(1) | Easy | ||
1040 | Moving Stones Until Consecutive II | C++ Python | O(nlogn) | O(1) | Medium | ||
1151 | Minimum Swaps to Group All 1's Together | C++ Python | O(n) | O(1) | Medium | π | Sliding Window |
1156 | Swap For Longest Repeated Character Substring | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
1176 | Diet Plan Performance | C++ Python | O(n) | O(1) | Easy | Sliding Window | |
1208 | Get Equal Substrings Within Budget | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
1213 | Intersection of Three Sorted Arrays | C++ Python | O(n) | O(1) | Easy | π | |
1169 | Invalid Transactions | C++ Python | O(nlogn) | O(n) | Medium | Sliding Window, Line Sweep | |
1214 | Two Sum BSTs | C++ Python | O(n) | O(n) | Medium | π | Stack |
1234 | Replace the Substring for Balanced String | C++ Python | O(n) | O(t) | Medium | Two Pointers, Sliding Window | |
1248 | Count Number of Nice Subarrays | C++ Python | O(n) | O(k) | Medium | variant of Subarrays with K Different Integers | Two Pointers, Sliding Window |
1297 | Maximum Number of Occurrences of a Substring | C++ Python | O(n) | O(n) | Medium | Sliding Window, Rabin-Karp Algorithm |
|
1305 | All Elements in Two Binary Search Trees | C++ Python | O(n) | O(h) | Medium | Stack | |
1316 | Distinct Echo Substrings | C++ Python | O(n^2 + d) | O(r) | Hard | KMP Algorithm , Sliding Window, Rabin-Karp Algorithm |
|
1358 | Number of Substrings Containing All Three Characters | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
1423 | Maximum Points You Can Obtain from Cards | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
1425 | Constrained Subset Sum | C++ Python | O(n) | O(k) | Hard | variant of Sliding Window Maximum | Mono Deque, Sliding Window |
1456 | Maximum Number of Vowels in a Substring of Given Length | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
1493 | Longest Subarray of 1's After Deleting One Element | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
1498 | Number of Subsequences That Satisfy the Given Sum Condition | C++ Python | O(nlogn) | O(n) | Medium | Two Pointers | |
1508 | Range Sum of Sorted Subarray Sums | C++ Python | O(nlog(sum(nums))) | O(n) | Medium | Binary Search, Two Pointers, Sliding Window | |
1521 | Find a Value of a Mysterious Function Closest to Target | C++ Python | O(nlogm) | O(logm) | Hard | DP, Two Pointers, Sliding Window | |
1604 | Alert Using Same Key-Card Three or More Times in a One Hour Period | C++ Python | O(nlogn) | O(n) | Medium | Two Pointers, Sliding Window | |
1658 | Minimum Operations to Reduce X to Zero | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
1687 | Delivering Boxes from Storage to Ports | C++ Python | O(nlogn) | O(n) | Hard | Two Pointers, Sliding Window | |
1695 | Maximum Erasure Value | C++ Python | O(n) | O(n) | Medium | Two Pointers, Sliding Window | |
1712 | Ways to Split Array Into Three Subarrays | C++ Python | O(n) | O(n) | Medium | Two Pointers, Prefix Sum | |
1750 | Minimum Length of String After Deleting Similar Ends | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
1838 | Frequency of the Most Frequent Element | C++ Python | O(nlogn) | O(n) | Medium | Two Pointers, Sliding Window | |
1852 | Distinct Numbers in Each Subarray | C++ Python | O(n) | O(k) | Medium | π | Two Pointers, Sliding Window |
1855 | Maximum Distance Between a Pair of Values | C++ Python | O(n + m) | O(1) | Medium | Two Pointers | |
1868 | Product of Two Run-Length Encoded Arrays | C++ Python | O(m + n) | O(1) | Medium | π | Two Pointers |
1885 | Count Pairs in Two Arrays | C++ Python | O(nlogn) | O(1) | Medium | π | Two Pointers |
1888 | Minimum Number of Flips to Make the Binary String Alternatings | C++ Python | O(n) | O(1) | Medium | 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 | done, go back, double binary search CTCI | |
0034 | Search for a Range | C++ Python | O(logn) | O(1) | Medium | done | |
0035 | Search Insert Position | C++ Python | O(logn) | O(1) | Medium | done, classic go back | |
0069 | Sqrt(x) | C++ Python | O(logn) | O(1) | Medium | done, classic go back | |
0074 | Search a 2D Matrix | C++ Python | O(logm + logn) | O(1) | Medium | done | |
0081 | Search in Rotated Sorted Array II | C++ Python | O(logn) ~ O(n) | O(1) | Medium | done, CTCI | |
0153 | Find Minimum in Rotated Sorted Array | C++ Python | O(logn) | O(1) | Medium | done | |
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 | done | |
0222 | Count Complete Tree Nodes | C++ Python | O((logn)^2) | O(1) | Medium | done, classic go back | |
0275 | H-Index II | C++ Python | O(logn) | O(1) | Medium | done | 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 | done, classic, go back, CTCI, LintCode | Binary Search, 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 | ||
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 | ||
0864 | Random Pick with Blacklist | C++ Python | ctor: O(b) pick: O(1) |
O(b) | Hard | ||
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 | ||
1011 | Capacity To Ship Packages Within D Days | C++ Python | O(nlogr) | O(1) | Medium | ||
1044 | Longest Duplicate Substring | C++ Python | O(nlogn) | O(n) | Hard | Rabin-Karp Algorithm , Suffix Tree, Ukkonen's Algorithm |
|
1060 | Missing Element in Sorted Array | C++ Python | O(logn) | O(1) | Medium | π | |
1062 | Longest Repeating Substring | C++ Python | O(nlogn) | O(n) | Medium | π | Rabin-Karp Algorithm |
1064 | Fixed Point | C++ Python | O(logn) | O(1) | Easy | π | |
1095 | Find in Mountain Array | C++ Python | O(logn) | O(1) | Hard | ||
1110 | Delete Nodes And Return Forest | C++ Python | O(n) | O(h + d) | Medium | ||
1170 | Compare Strings by Frequency of the Smallest Character | C++ Python | O((m + n)logn) | O(n) | Easy | ||
1201 | Ugly Number III | C++ Python | O(logn) | O(1) | Medium | Inclusion-Exclusion Principle | |
1228 | Missing Number In Arithmetic Progression | C++ Python | O(logn) | O(1) | Easy | ||
1231 | Divide Chocolate | C++ Python | O(nlogn) | O(1) | Hard | ||
1274 | Number of Ships in a Rectangle | C++ Python | O(log(m * n)) | O(log(m * n)) | Hard | Divide and Conquer | |
1283 | Find the Smallest Divisor Given a Threshold | C++ Python | O(logn) | O(1) | Medium | ||
1287 | Element Appearing More Than 25% In Sorted Array | C++ Python | O(logn) | O(1) | Easy | ||
1385 | Find the Distance Value Between Two Arrays | C++ Python | O((n + m) * logm) | O(1) | Easy | Binary Search, Two Pointers | |
1482 | Minimum Number of Days to Make m Bouquets | C++ Python | O(nlogd) | O(1) | Medium | ||
1533 | Find the Index of the Large Integer | C++ Python | O(logn) | O(1) | Medium | π | |
1539 | Kth Missing Positive Number | C++ Python | O(logn) | O(1) | Easy | ||
1552 | Magnetic Force Between Two Balls | C++ Python | O(nlogn + nlogr) | O(1) | Medium | ||
1618 | Maximum Font to Fit a Sentence in a Screen | C++ Python | O(n + logm) | O(1) | Medium | π | |
1648 | Sell Diminishing-Valued Colored Balls | C++ Python | O(nlogm) | O(1) | Medium | ||
1671 | Minimum Number of Removals to Make Mountain Array | C++ Python | O(nlogn) | O(n) | Medium | variant of Longest Increasing Subsequence | Binary Search, DP |
1713 | Minimum Operations to Make a Subsequence | C++ Python | O(nlogn) | O(n) | Hard | variant of Longest Increasing Subsequence | Binary Search, Segment Tree |
1760 | Minimum Limit of Balls in a Bag | C++ Python | O(nlogm) | O(1) | Medium | ||
1802 | Maximum Value at a Given Index in a Bounded Array | C++ Python | O(logm) | O(1) | Medium | ||
1818 | Minimum Absolute Sum Difference | C++ Python | O(nlogn) | O(n) | Medium | ||
1870 | Minimum Speed to Arrive on Time | C++ Python | O(nlogr) | O(1) | Medium | ||
1889 | Minimum Space Wasted From Packaging | C++ Python | O(mlogm + nlogn + mlogn) | O(1) | Hard | ||
1891 | Cutting Ribbons | C++ Python | O(nlogr) | O(1) | Medium | π | |
1898 | Maximum Number of Removable Characters | C++ Python | O(rlogn) | O(r) | Medium | ||
1901 | Find a Peak Element II | C++ Python | O(min(n, m) * log(max(n, m))) | O(1) | Medium | ||
1918 | Kth Smallest Subarray Sum | C++ Python | O(nlogr) | 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 | done, go back | |
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 | done, go back, hard, CTCI | Bi-BFS |
0130 | Surrounded Regions | C++ Python | O(m * n) | O(m + n) | Medium | done, go back | |
0133 | Clone Graph | Python | O(n) | O(n) | Medium | done | |
0207 | Course Schedule | C++ Python | O(|V| + |E|) | O(|E|) | Medium | Topological Sort | |
0210 | Course Schedule II | C++ Python | O(|V| + |E|) | O(|E|) | Medium | done, go back | Topological Sort |
0261 | Graph Valid Tree | C++ Python | O(|V| + |E|) | O(|V| + |E|) | Medium | done, go backπ | |
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 | done, go back π | |
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 | ||
0865 | 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 | ||
1034 | Coloring A Border | C++ Python | O(m * n) | O(m + n) | Medium | ||
1036 | Escape a Large Maze | C++ Python | O(n^2) | O(n) | Hard | ||
1091 | Shortest Path in Binary Matrix | C++ Python | O(n^2) | O(n) | Medium | ||
1102 | Path With Maximum Minimum Value | C++ Python | O((m * n) * log(m * n)) | O(m * n) | Medium | π | Binary Search, DFS, Dijkstra's Algorithm |
1129 | Shortest Path with Alternating Colors | C++ Python | O(n + e) | O(n + e) | Medium | ||
1136 | Parallel Courses | C++ Python | O(|V| + |E|) | O(|E|) | Hard | π | Topological Sort |
1161 | Maximum Level Sum of a Binary Tree | C++ Python | O(n) | O(w) | Medium | DFS | |
1162 | As Far from Land as Possible | C++ Python | O(m * n) | O(m * n) | Medium | ||
1203 | Sort Items by Groups Respecting Dependencies | C++ Python | O(n + e) | O(n + e) | Hard | Topological Sort | |
1210 | Minimum Moves to Reach Target with Rotations | C++ Python | O(n) | O(n) | Hard | ||
1215 | Stepping Numbers | C++ Python | O(logk + r) | O(k) | Medium | π | Precompute, Binary Search |
1245 | Tree Diameter | C++ Python | O(|V| + |E|) | O(|E|) | Medium | ||
1263 | Minimum Moves to Move a Box to Their Target Location | C++ Python | O(m^2 * n^2) | O(m^2 * n^2) | Hard | A* Search Algorithm |
|
1284 | Minimum Number of Flips to Convert Binary Matrix to Zero Matrix | C++ Python | O((m * n) * 2^(m * n)) | O((m * n) * 2^(m * n)) | Hard | ||
1291 | Sequential Digits | C++ Python | O(1) | O(1) | Medium | ||
1293 | Shortest Path in a Grid with Obstacles Elimination | C++ Python | O(m * n * k) | O(m * n) | Hard | A* Search Algorithm |
|
1298 | Maximum Candies You Can Get from Boxes | C++ Python | O(n^2) | O(n) | Hard | ||
1302 | Deepest Leaves Sum | C++ Python | O(n) | O(w) | Medium | ||
1306 | Jump Game III | C++ Python | O(n) | O(n) | Medium | ||
1311 | Get Watched Videos by Your Friends | C++ Python | O(n + vlogv) | O(w) | Medium | ||
1345 | Jump Game IV | C++ Python | O(n) | O(n) | Hard | ||
1368 | Minimum Cost to Make at Least One Valid Path in a Grid | C++ Python | O(m * n) | O(m * n) | Hard | A* Search Algorithm , 0-1 BFS, Deque |
|
1514 | Path with Maximum Probability | C++ Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's Algorithm |
|
1602 | Find Nearest Right Node in Binary Tree | C++ Python | O(n) | O(w) | Medium | π | |
1609 | Even Odd Tree | C++ Python | O(n) | O(w) | Medium | ||
1625 | Lexicographically Smallest String After Applying Operations | C++ Python | O(n^2) | O(1) | Medium | BFS, String | |
1654 | Minimum Jumps to Reach Home | C++ Python | O(max(x, max(forbidden)) + a + b) | O(max(x, max(forbidden)) + a + b) | Medium | BFS | |
1660 | Correct a Binary Tree | C++ Python | O(n) | O(w) | Medium | π | BFS |
1728 | Cat and Mouse II | C++ Python | O((m * n)^2 * (m + n)) | O((m * n)^2) | Hard | variant of Cat and Mouse | MiniMax, Topological Sort |
1730 | Shortest Path to Get Food | C++ Python | O(m * n) | O(m + n) | Medium | π | BFS |
1765 | Map of Highest Peak | C++ Python | O(m * n) | O(m * n) | Medium | BFS | |
1926 | Nearest Exit from Entrance in Maze | C++ Python | O(m * n) | O(m + n) | Medium | Bi-BFS | |
1928 | Minimum Cost to Reach Destination in Time | C++ Python | O(|E| * log|V|) | O(|E|) | Hard | variant of Cheapest Flights Within K Stops | Dijkstra's Algorithm |
# | 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 | done, go back | |
0199 | Binary Tree Right Side View | Python | O(n) | O(h) | Medium | done, go back | |
0200 | Number of Islands | C++ Python | O(m * n) | O(m * n) | Medium | done | BFS, DFS, Union Find |
0236 | Lowest Common Ancestor of a Binary Tree | C++ Python | O(n) | O(h) | Medium | done, go back EPI | |
0247 | Strobogrammatic Number II | C++ Python | O(n * 5^(n/2)) | O(n) | Medium | doneπ | |
0250 | Count Univalue Subtrees | C++ Python | O(n) | O(h) | Medium | undone, unknown bug???π | |
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 | |
0332 | Reconstruct Itinerary | C++ Python | O(t! / (n1! * n2! * ... nk!)) | O(t) | Medium | ||
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 | ||
1020 | Number of Enclaves | C++ Python | O(m * n) | O(m * n) | Medium | ||
1059 | All Paths from Source Lead to Destination | C++ Python | O(n + e) | O(n + e) | Medium | π | |
1192 | Critical Connections in a Network | C++ Python | O(|V| + |E|) | O(|V| + |E|) | Hard | Tarjan's Algorithm , Bridge Finding Algorithm |
|
1202 | Smallest String With Swaps | C++ Python | O(nlogn) | O(n) | Medium | Union Find | |
1254 | Number of Closed Islands | C++ Python | O(m * n) | O(1) | Medium | ||
1273 | Delete Tree Nodes | C++ Python | O(n) | O(n) | Medium | DFS, DP | |
1315 | Sum of Nodes with Even-Valued Grandparent | C++ Python | O(n) | O(h) | Medium | ||
1319 | Number of Operations to Make Network Connected | C++ Python | O(|E| + |V|) | O(|V|) | Medium | Union Find | |
1367 | Linked List in Binary Tree | C++ Python | O(n + l) | O(h + l) | Medium | KMP Algorithm |
|
1372 | Longest ZigZag Path in a Binary Tree | C++ Python | O(n) | O(h) | Medium | ||
1376 | Time Needed to Inform All Employees | C++ Python | O(n) | O(n) | Medium | ||
1377 | Frog Position After T Seconds | C++ Python | O(n) | O(n) | Hard | DFS, Stack, BFS | |
1391 | Check if There is a Valid Path in a Grid | C++ Python | O(m * n) | O(1) | Medium | Simulation | |
1466 | Reorder Routes to Make All Paths Lead to the City Zero | C++ Python | O(n) | O(n) | Medium | DFS, Stack | |
1485 | Clone Binary Tree With Random Pointer | C++ Python | O(n) | O(h) | Medium | π | DFS, Stack |
1644 | Lowest Common Ancestor of a Binary Tree II | C++ Python | O(n) | O(h) | Medium | π | DFS, Stack |
1676 | Lowest Common Ancestor of a Binary Tree IV | C++ Python | O(n) | O(h) | Medium | π | DFS, Stack |
1722 | Minimize Hamming Distance After Swap Operations | C++ Python | O(n) | O(n) | Medium | Flood Fill, Union Find | |
1740 | Find Distance in a Binary Tree | C++ Python | O(n) | O(h) | Medium | variant of Lowest Common Ancestor of a Binary Tree, π | |
1766 | Tree of Coprimes | C++ Python | O(n) | O(n) | Hard | ||
1905 | Count Sub Islands | C++ Python | O(m * n) | O(1) | Medium | Flood Fill |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
0017 | Letter Combinations of a Phone Number | C++ Python | O(n * 4^n) | O(1) | Medium | done | |
0022 | Generate Parentheses | C++ Python | O(4^n / n^(3/2)) | O(n) | Medium | done, go back | |
0037 | Sudoku Solver | Python | O((9!)^9) | O(1) | Hard | ||
0039 | Combination Sum | Python | O(k * n^k) | O(k) | Medium | done, go back | |
0040 | Combination Sum II | Python | O(k * C(n, k)) | O(k) | Medium | done, go back | |
0046 | Permutations | Python | O(n * n!) | O(n) | Medium | done, go back | |
0047 | Permutations II | Python | O(n * n!) | O(n) | Medium | done | |
0051 | N-Queens | Python | O(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 | done | |
0079 | Word Search | C++ Python | O(m * n * 3^l) | O(l) | Medium | done, go back | |
0093 | Restore IP Addresses | Python | O(1) | O(1) | Medium | done, hard, go back | |
0078 | Subsets | C++ Python | O(n * 2^n) | O(1) | Medium | done | |
0090 | Subsets II | C++ Python | O(n * 2^n) | O(1) | Medium | done, go back | |
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 | done | |
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 | done | |
0254 | Factor Combinations | C++ Python | O(nlogn) | O(logn) | Medium | done, go backπ | |
0267 | Palindrome Permutation II | C++ Python | O(n * n!) | O(n) | Medium | done, go backπ | |
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 | done, go backπ | DP, Hash |
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 | π | |
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 | ||
1087 | Brace Expansion | C++ Python | O(p * l * log(p * l)) | O(p * l) | Medium | π | |
1096 | Brace Expansion II | C++ Python | O(p * l * log(p * l)) | O(p * l) | Hard | ||
1219 | Path with Maximum Gold | C++ Python | O(m^2 * n^2) | O(m * n) | Medium | ||
1240 | Tiling a Rectangle with the Fewest Squares | C++ Python | O(n^2 * m^2 * m^(n * m)) | O(n * m) | Hard | ||
1255 | Maximum Score Words Formed by Letters | C++ Python | O(n * 2^n) | O(n) | Hard | ||
1258 | Synonymous Sentences | C++ Python | O(p * l * log(p * l)) | O(p * l) | Medium | Union Find | |
1307 | Verbal Arithmetic Puzzle | C++ Python | O(10! * n * l) | O(n * l) | Hard | ||
1379 | Find a Corresponding Node of a Binary Tree in a Clone of That Tree | C++ Python | O(n) | O(h) | Medium | Stack | |
1593 | Split a String Into the Max Number of Unique Substrings | C++ Python | O(n * 2^(n - 1)) | O(n) | Medium | ||
1659 | Maximize Grid Happiness | C++ Python | O(C(m * n, i) * C(m * n - i, e)) | O(min(m * n, i + e)) | Hard | Pruning | |
1718 | Construct the Lexicographically Largest Valid Sequence | C++ Python | O(n!) | O(b) | Medium | Backtracking | |
1723 | Find Minimum Time to Finish All Jobs | C++ Python | O(k^n * logr) | O(n + k) | Hard | Backtracking, Pruning, Binary Search | |
1849 | Splitting a String Into Descending Consecutive Values | C++ Python | O(n^2) | O(n) | Medium |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
0399 | Evaluate Division | C++ Python | O(e + q) | O(e) | 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 | |
1042 | Flower Planting With No Adjacent | C++ Python | O(n) | O(n) | Easy | ||
1101 | The Earliest Moment When Everyone Become Friends | C++ Python | O(nlogn) | O(n) | Medium | π | Union Find |
1135 | Connecting Cities With Minimum Cost | C++ Python | O(nlogn) | O(n) | Medium | π | Union Find, Kruskal's Algorithm , MST |
1168 | Optimize Water Distribution in a Village | C++ Python | O(nlogn) | O(n) | Hard | π | Union Find |
1334 | Find the City With the Smallest Number of Neighbors at a Threshold Distance | C++ Python | O(n^3) | O(n^2) | Medium | Floyd-Warshall Algorithm |
|
1361 | Validate Binary Tree Nodes | C++ Python | O(n) | O(n) | Medium | DFS, Tree | |
1462 | Course Schedule IV | C++ Python | O(n^3) | O(n^2) | Medium | Floyd-Warshall Algorithm |
|
1489 | Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree | C++ Python | O(nlogn) | O(n) | Hard | Kruskal Algorithm |
|
1557 | Minimum Number of Vertices to Reach All Nodes | C++ Python | O(e) | O(n) | Medium | ||
1579 | Remove Max Number of Edges to Keep Graph Fully Traversable | C++ Python | O(n + m) | O(n) | Hard | Union Find | |
1584 | Min Cost to Connect All Points | C++ Python | O(n^2) | O(n) | Medium | Union Find, Kruskal's Algorithm , MST |
|
1601 | Maximum Number of Achievable Transfer Requests | C++ Python | O((n + r) * 2^r) | O(n + r) | Hard | Combinations, Backtracking | |
1615 | Maximal Network Rank | C++ Python | O(m + n + k^2) | O(m + n) | Medium | Counting Sort | |
1627 | Graph Connectivity With Threshold | C++ Python | O(nlogn + q) | O(n) | Hard | Union Find, Math | |
1631 | Path With Minimum Effort | C++ Python | O(m * n * log(m * n)) | O(m * n) | Medium | Binary Search, DFS, BFS, Bi-BFS, Union Find, Dijkstra's Algorithm |
|
1697 | Checking Existence of Edge Length Limited Paths | C++ Python | O(nlogn + mlogm) | O(n) | Hard | Union Find | |
1719 | Number Of Ways To Reconstruct A Tree | C++ Python | O(nlogn) | O(n) | Hard | ||
1724 | Checking Existence of Edge Length Limited Paths II | C++ Python | ctor: O(nlogn + mlogm) query: O(logn) |
O(nlogn + m) | Hard | π | Versioned Union Find, Binary Lifting |
1743 | Restore the Array From Adjacent Pairs | C++ Python | O(n) | O(n) | Medium | ||
1761 | Minimum Degree of a Connected Trio in a Graph | C++ Python | O(n^3) | O(n^2) | Hard | ||
1778 | Shortest Path in a Hidden Grid | C++ Python | O(m * n) | O(m * n) | Medium | π | DFS, BFS, Bi-BFS |
1782 | Count Pairs Of Nodes | C++ Python | O(n + e + q) | O(n + e) | Hard | Counting, Two Pointers | |
1786 | Number of Restricted Paths From First to Last Node | C++ Python | O(|E| * log|V|) | O(|E|) | Medium | Dijkstra's Algorithm , DP |
|
1791 | Find Center of Star Graph | C++ Python | O(n) | O(n) | Medium | ||
1810 | Minimum Path Cost in a Hidden Grid | C++ Python | O(m * n * log(m * n)) | O(m * n) | Medium | π | DFS, Dijkstra's Algorithm |
1820 | Maximum Number of Accepted Invitations | C++ Python | O(m * n * sqrt(m + n)) | O(m + n) | Medium | π | Hopcroft-Karp Bipartite Matching , Hungarian Bipartite Matching |
1879 | Minimum XOR Sum of Two Arrays | C++ Python | O(n^3) | O(n^2) | Hard | DP, Hungarian Weighted Bipartite Matching |
# | 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 | ||
1453 | Maximum Number of Darts Inside of a Circular Dartboard | C++ Python | O(n^2 * logn) | O(n) | Hard | Line Sweep | |
1515 | Best Position for a Service Centre | C++ Python | O(n * iter) | O(n) | Hard | Geometric Median, Gradient Descent, Weiszfeld's Algorithm | |
1610 | Maximum Number of Visible Points | C++ Python | O(nlogn) | O(n) | Hard | Two Pointers, Sliding Window | |
1924 | Erect the Fence II | C++ Python | O(n) on average | O(n) | Hard | π | Welzl's Algorithm |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
0874 | Walking Robot Simulation | C++ Python | O(n + k) | O(k) | Easy | ||
1138 | Alphabet Board Path | C++ Python | O(n) | O(1) | Medium | ||
1243 | Array Transformation | C++ Python | O(n^2) | O(n) | 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 | done, go back | |
0284 | Peeking Iterator | C++ Python | O(1) | O(1) | Medium | done | |
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(klogu) | 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 | π | |
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 | π | |
0642 | Design Search Autocomplete System | C++ Python | O(p^2) | O(p * t + s) | Hard | π | |
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 | ||
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 | |
1348 | Tweet Counts Per Frequency | C++ Python | add: O(logn) query: O(c) |
O(n) | Medium | ||
1352 | Product of the Last K Numbers | C++ Python | ctor: O(1) add: O(1) get: O(1) |
O(n) | Medium | ||
1357 | Apply Discount Every n Orders | C++ Python | ctor: O(m) getBill: O(p) |
O(m) | Medium | ||
1381 | Design a Stack With Increment Operation | C++ Python | ctor: O(1) push: O(1) pop: O(1) increment: O(1) |
O(n) | Medium | ||
1396 | Design Underground System | C++ Python | ctor: O(1) checkin: O(1) checkout: O(1) getaverage: O(1) |
O(n) | Medium | ||
1429 | First Unique Number | C++ Python | ctor: O(k) add: O(1) showFirstUnique: O(1) |
O(n) | Medium | π | LinkedHashSet |
1472 | Design Browser History | C++ Python | ctor: O(1) visit: O(1) back: O(1) forward: O(1) |
O(n) | Medium | ||
1476 | Subrectangle Queries | C++ Python | ctor: O(1) update: O(1) get: O(u) |
O(u) | Medium | ||
1483 | Kth Ancestor of a Tree Node | C++ Python | ctor: O(n * logh) get: O(logh) |
O(n * logh) | Hard | DP, Binary Lifting | |
1500 | Design a File Sharing System | C++ Python | ctor: O(1) join: O(logu + c) leave: O(logu + c) request: O(u) |
O(u * c) | Medium | π | |
1570 | Dot Product of Two Sparse Vectors | C++ Python | ctor: O(n) dot_product: O(min(n, m)) |
O(n) | Medium | π | |
1586 | Binary Search Tree Iterator II | C++ Python | O(1), amortized | O(h) | Medium | π | |
1600 | Throne Inheritance | C++ Python | ctor: O(1) birth: O(1) death: O(1) inherit: O(n) |
O(n) | Medium | ||
1603 | Design Parking System | C++ Python | O(1) | O(1) | Easy | ||
1622 | Fancy Sequence | C++ Python | O(1) | O(n) | Hard | Euler's Theorem |
|
1628 | Design an Expression Tree With Evaluate Function | C++ Python | O(n) | O(h) | Medium | π | |
1656 | Design an Ordered Stream | C++ Python | O(1), amortized | O(n) | Easy | ||
1670 | Design Front Middle Back Queue | C++ Python | O(1) | O(n) | Medium | ||
1756 | Design Most Recently Used Queue | C++ Python | ctor: O(nlogn) fetch: O(logn) |
O(n) | Medium | π | SortedList, BIT, Fenwick Tree, Square Root Decomposition |
1797 | Design Authentication Manager | C++ Python | ctor: O(1) generate: O(1), amortized renew: O(1), amortized count: O(1), amortized |
O(n) | Medium | OrderedDict | |
1804 | Implement Trie II (Prefix Tree) | C++ Python | ctor: O(1) insert: O(n) count_word: O(n) count_prefix: O(n) erase: O(n) |
O(t) | Medium | π | Trie |
1825 | Finding MK Average | C++ Python | ctor: O(1) add_element: O(logn) calc_mkaverge: O(1) |
O(m) | Hard | SortedList | |
1845 | Seat Reservation Manager | C++ Python | ctor: O(n) reserve: O(logn) unreserve: O(logn) |
O(n) | Medium | Heap | |
1865 | Finding Pairs With a Certain Sum | C++ Python | ctor: O(n1 + n2) add: O(1) count: O(n1) |
O(n1 + n2) | Medium | Hash Table | |
1912 | Design Movie Rental System | C++ Python | ctor: O(nlogn) search: O(logn) rent: O(logn) drop: O(logn) report: O(logn) |
O(n) | Hard | Ordered List |
# | 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 |
---|---|---|---|---|---|---|---|
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 | π | |
1045 | Customers Who Bought All Products | MySQL | O(n + k) | O(n + k) | Medium | π | |
1050 | Actors and Directors Who Cooperated At Least Three Times | MySQL | O(n) | O(n) | Easy | π | |
1068 | Product Sales Analysis I | MySQL | O(m + n) | O(m + n) | Easy | π | |
1069 | Product Sales Analysis II | MySQL | O(n) | O(n) | Easy | π | |
1070 | Product Sales Analysis III | MySQL | O(n) | O(n) | Medium | π | |
1075 | Project Employees I | MySQL | O(m + n) | O(m + n) | Easy | π | |
1076 | Project Employees II | MySQL | O(n) | O(n) | Easy | π | |
1077 | Project Employees III | MySQL | O((m + n)^2) | O(m + n) | Medium | π | |
1082 | Sales Analysis I | MySQL | O(n) | O(n) | Easy | π | |
1083 | Sales Analysis II | MySQL | O(m + n) | O(m + n) | Easy | π | |
1084 | Sales Analysis III | MySQL | O(m + n) | O(m + n) | Easy | π | |
1097 | Game Play Analysis V | MySQL | O(n^2) | O(n) | Hard | π | |
1098 | Unpopular Books | MySQL | O(m + n) | O(n) | Medium | π | |
1107 | New Users Daily Count | MySQL | O(n) | O(n) | Medium | π | |
1112 | Highest Grade For Each Student | MySQL | O(nlogn) | O(n) | Medium | π | |
1113 | Reported Posts | MySQL | O(n) | O(n) | Easy | π | |
1126 | Active Businesses | MySQL | O(n) | O(n) | Medium | π | |
1127 | User Purchase Platform | MySQL | O(n) | O(n) | Hard | π | |
1132 | Reported Posts II | MySQL | O(m + n) | O(n) | Medium | π | |
1141 | User Activity for the Past 30 Days I | MySQL | O(n) | O(n) | Easy | π | |
1142 | User Activity for the Past 30 Days II | MySQL | O(n) | O(n) | Easy | π | |
1148 | Article Views I | MySQL | O(nlogn) | O(n) | Easy | π | |
1149 | Article Views II | MySQL | O(nlogn) | O(n) | Medium | π | |
1158 | Market Analysis I | MySQL | O(m + n) | O(m + n) | Medium | π | |
1159 | Market Analysis II | MySQL | O(m + n) | O(m + n) | Hard | π | |
1164 | Product Price at a Given Date | MySQL | O(mlogn) | O(m) | Medium | π | |
1173 | Immediate Food Delivery I | MySQL | O(n) | O(1) | Easy | π | |
1174 | Immediate Food Delivery II | MySQL | O(n) | O(m) | Medium | π | |
1179 | Reformat Department Table | MySQL | O(n) | O(n) | Easy | π | |
1193 | Monthly Transactions I | MySQL | O(n) | O(n) | Medium | π | |
1194 | Tournament Winners | MySQL | O(m + n + nlogn) | O(m + n) | Hard | π | |
1204 | Last Person to Fit in the Elevator | MySQL | O(nlogn) | O(n) | Medium | π | |
1205 | Monthly Transactions II | MySQL | O(n) | O(n) | Medium | π | |
1211 | Queries Quality and Percentage | MySQL | O(n) | O(n) | Easy | ||
1212 | Team Scores in Football Tournament | MySQL | O(nlogn) | O(n) | Medium | ||
1225 | Report Contiguous Dates | MySQL | O(nlogn) | O(n) | Hard | π | |
1241 | Number of Comments per Post | MySQL | O(n) | O(n) | Easy | π | |
1251 | Average Selling Price | MySQL | O(n) | O(n) | Easy | π | |
1264 | Page Recommendations | MySQL | O(m + n) | O(m) | Medium | π | |
1270 | All People Report to the Given Manager | MySQL | O(n) | O(n) | Medium | π | |
1280 | Students and Examinations | MySQL | O((m * n) * log(m * n)) | O(m * n) | Easy | π | |
1285 | Find the Start and End Number of Continuous Ranges | MySQL | O(n) | O(n) | Medium | π | |
1294 | Weather Type in Each Country | MySQL | O(m + n) | O(n) | Easy | π | |
1303 | Find the Team Size | MySQL | O(n) | O(n) | Easy | π | |
1308 | Running Total for Different Genders | MySQL | O(nlogn) | O(n) | Medium | π | |
1321 | Restaurant Growth | MySQL | O(n^2) | O(n) | Medium | π | |
1322 | Ads Performance | MySQL | O(nlogn) | O(n) | Easy | π | |
1327 | List the Products Ordered in a Period | MySQL | O(n) | O(n) | Easy | π | |
1336 | Number of Transactions per Visit | MySQL | O(m + n) | O(m + n) | Medium | π | |
1341 | Movie Rating | MySQL | O(nlogn) | O(n) | Medium | π | |
1350 | Students With Invalid Departments | MySQL | O(n) | O(n) | Easy | π | |
1355 | Activity Participants | MySQL | O(n) | O(n) | Medium | π | |
1364 | Number of Trusted Contacts of a Customer | MySQL | O(n + m + l + nlogn) | O(n + m + l) | Medium | π | |
1369 | Get the Second Most Recent Activity | MySQL | O(nlogn) | O(n) | Hard | π | |
1378 | Replace Employee ID With The Unique Identifier | MySQL | O(n) | O(n) | Easy | π | |
1384 | Total Sales Amount by Year | MySQL | O(nlogn) | O(n) | Hard | π | |
1393 | Capital Gain/Loss | MySQL | O(n) | O(n) | Medium | π | |
1398 | Customers Who Bought Products A and B but Not C | MySQL | O(m + n) | O(m + n) | Medium | π | |
1407 | Top Travellers | MySQL | O(m + nlogn) | O(m + n) | Easy | π | |
1412 | Find the Quiet Students in All Exams | MySQL | O(m + nlogn) | O(m + n) | Hard | π | |
1421 | NPV Queries | MySQL | O(n) | O(n) | Medium | π | |
1435 | Create a Session Bar Chart | MySQL | O(n) | O(1) | Easy | π | |
1440 | Evaluate Boolean Expression | MySQL | O(n) | O(n) | Medium | π | |
1445 | Apples & Oranges | MySQL | O(n) | O(n) | Medium | π | |
1454 | Active Users | MySQL | O(nlogn) | O(n) | Medium | π | |
1459 | Rectangles Area | MySQL | O(n^2) | O(n^2) | Medium | π | |
1468 | Calculate Salaries | MySQL | O(m + n) | O(m + n) | Easy | π | |
1479 | Sales by Day of the Week | MySQL | O(m + n) | O(n) | Hard | π | |
1484 | Group Sold Products By The Date | MySQL | O(nlogn) | O(n) | Easy | π | |
1495 | Friendly Movies Streamed Last Month | MySQL | O(n) | O(n) | Easy | π | |
1501 | Countries You Can Safely Invest In | MySQL | O(n) | O(n) | Medium | π | |
1511 | Customer Order Frequency | MySQL | O(n) | O(n) | Easy | π | |
1517 | Find Users With Valid E-Mails | MySQL | O(n) | O(n) | Easy | π | Regex |
1527 | Patients With a Condition | MySQL | O(n) | O(n) | Easy | π | Regex |
1532 | The Most Recent Three Orders | MySQL | O(nlogn) | O(n) | Medium | π | |
1543 | Fix Product Name Format | MySQL | O(nlogn) | O(n) | Easy | π | |
1549 | The Most Recent Orders for Each Product | MySQL | O(nlogn) | O(n) | Medium | π | |
1555 | Bank Account Summary | MySQL | O(m + n) | O(m + n) | Medium | π | |
1565 | Unique Orders and Customers Per Month | MySQL | O(n) | O(n) | Easy | π | |
1571 | Warehouse Manager | MySQL | O(n) | O(n) | Medium | π | |
1581 | Customer Who Visited but Did Not Make Any Transactions | MySQL | O(n) | O(n) | Easy | π | |
1587 | Bank Account Summary II | MySQL | O(m + n) | O(m + n) | Easy | π | |
1596 | The Most Frequently Ordered Products for Each Customer | MySQL | O(n) | O(n) | Medium | π | |
1607 | Sellers With No Sales | MySQL | O(nlogm) | O(n + m) | Medium | π | |
1613 | Find the Missing IDs | MySQL | O(n^2) | O(n) | Medium | π | |
1623 | All Valid Triplets That Can Represent a Country | MySQL | O(n^3) | O(n^3) | Easy | π | |
1633 | Percentage of Users Attended a Contest | MySQL | O(m + nlogn) | O(n) | Easy | π | |
1635 | Hopper Company Queries I | MySQL | O(d + r + tlogt) | O(d + r + t) | Hard | π | |
1645 | Hopper Company Queries II | MySQL | O(d + r + tlogt) | O(d + r + t) | Hard | π | |
1651 | Hopper Company Queries III | MySQL | O(d + r + tlogt) | O(d + r + t) | Hard | π | |
1661 | Average Time of Process per Machine | MySQL | O(n) | O(n) | Easy | π | |
1667 | Fix Names in a Table | MySQL | O(nlogn) | O(n) | Easy | π | |
1677 | Product's Worth Over Invoices | MySQL | O(nlogn) | O(n) | Easy | π | |
1683 | Invalid Tweets | MySQL | O(n) | O(n) | Easy | π | |
1693 | Daily Leads and Partners | MySQL | O(n) | O(n) | Easy | π | |
1699 | Number of Calls Between Two Persons | MySQL | O(n) | O(n) | Medium | π | |
1709 | Biggest Window Between Visits | MySQL | O(nlogn) | O(n) | Medium | π | |
1715 | Count Apples and Oranges | MySQL | O(n) | O(n) | Medium | π | |
1729 | Find Followers Count | MySQL | O(nlogn) | O(n) | Easy | π | |
1731 | The Number of Employees Which Report to Each Employee | MySQL | O(nlogn) | O(n) | Easy | π | |
1741 | Find Total Time Spent by Each Employee | MySQL | O(nlogn) | O(n) | Easy | π | |
1747 | Leetflex Banned Accounts | MySQL | O(n^2) | O(n) | Medium | π | |
1757 | Recyclable and Low Fat Products | MySQL | O(n) | O(n) | Easy | π | |
1767 | Find the Subtasks That Did Not Execute | MySQL | O(n * c) | O(n * c) | Hard | π | |
1777 | Product's Price for Each Store | MySQL | O(n) | O(n) | Easy | π | |
1783 | Grand Slam Titles | MySQL | O(n) | O(n) | Medium | π | |
1789 | Primary Department for Each Employee | MySQL | O(n) | O(n) | Easy | π | |
1795 | Rearrange Products Table | MySQL | O(n) | O(n) | Easy | π | |
1809 | Ad-Free Sessions | MySQL | O(n) | O(n) | Easy | π | |
1811 | Find Interview Candidates | MySQL | O(nlogn) | O(n) | Medium | π | |
1821 | Find Customers With Positive Revenue this Year | MySQL | O(n) | O(n) | Easy | π | |
1831 | Maximum Transaction Each Day | MySQL | O(nlogn) | O(n) | Medium | π | |
1841 | League Statistics | MySQL | O(nlogn) | O(n) | Medium | π | |
1843 | Suspicious Bank Accounts | MySQL | O(nlogn) | O(n) | Medium | π | |
1853 | Convert Date Format | MySQL | O(n) | O(n) | Easy | π | |
1867 | Orders With Maximum Quantity Above Average | MySQL | O(n) | O(n) | Easy | π | |
1873 | Calculate Special Bonus | MySQL | O(n) | O(n) | Easy | π | |
1875 | Group Employees of the Same Salary | MySQL | O(nlogn) | O(n) | Medium | π | |
1890 | The Latest Login in 2020 | MySQL | O(n) | O(n) | Easy | π | |
1892 | Page Recommendations II | MySQL | O(n * m) | O(n * m) | Hard | π | |
1907 | Count Salary Categories | MySQL | O(n) | O(n) | Medium | π | |
1917 | Leetcodify Friends Recommendations | MySQL | O(n^2) | O(n^2) | Hard | π | |
1919 | Leetcodify Similar Friends | MySQL | O(n * l) | O(n * l) | Hard | π | |
1934 | Confirmation Rate | MySQL | O(n + m) | O(n + m) | Medium | π |
# | 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 |