- 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
- Constructive Algorithms
- Design
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2151 | Maximum Good People Based on Statements | C++ Python | O(n^2 * 2^n) | O(1) | Hard | Bitmasks, Brute Force | |
2212 | Maximum Points in an Archery Competition | C++ Python | O(n * 2^n) | O(n) | Medium | Bitmasks, Brute Force | |
2220 | Minimum Bit Flips to Convert Number | C++ Python | O(logn) | O(1) | Easy | Bit Manipulation | |
2275 | Largest Combination With Bitwise AND Greater Than Zero | C++ Python | O(nlogr) | O(logr) | Medium | Bit Manipulation, Freq Table | |
2317 | Maximum XOR After Operations | C++ Python | O(n) | O(1) | Medium | Bit Manipulation, Greedy | |
2397 | Maximum Rows Covered by Columns | C++ Python | O(m * n + m * C(n, k)) | O(m) | Medium | Bitmasks, Hakmem Item 175 |
|
2411 | Smallest Subarrays With Maximum Bitwise OR | C++ Python | O(n) | O(1) | Medium | Bitmasks, Hash Table | |
2419 | Longest Subarray With Maximum Bitwise AND | C++ Python | O(n) | O(1) | Medium | Bit Manipulation | |
2425 | Bitwise XOR of All Pairings | C++ Python | O(n) | O(1) | Medium | Bit Manipulation | |
2429 | Minimize XOR | C++ Python | O(logn) | O(1) | Medium | Bit Manipulation, Greedy | |
2505 | Bitwise OR of All Subsequence Sums | C++ Python | O(n) | O(1) | Medium | ๐ | Bit Manipulation |
2527 | Find Xor-Beauty of Array | C++ Python | O(n) | O(1) | Medium | Bit Manipulation, Math | |
2595 | Number of Even and Odd Bits | C++ Python | O(1) | O(1) | Easy | Bit Manipulation | |
2859 | Sum of Values at Indices With K Set Bits | C++ Python | O(C(ceil(log2(n)), k)) | O(1) | Easy | Bitmasks, Hakmem Item 175 |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2058 | Find the Minimum and Maximum Number of Nodes Between Critical Points | C++ Python | O(n) | O(1) | Medium | ||
2074 | Reverse Nodes in Even Length Groups | C++ Python | O(n) | O(1) | Medium | ||
2095 | Delete the Middle Node of a Linked List | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
2130 | Maximum Twin Sum of a Linked List | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
2181 | Merge Nodes in Between Zeros | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
2487 | Remove Nodes From Linked List | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
2674 | Split a Circular Linked List | C++ Python | O(n) | O(1) | Medium | ๐ | Two Pointers, Slow and Fast Pointers |
2807 | Insert Greatest Common Divisors in Linked List | C++ Python | O(n) | O(1) | Medium | Linked List | |
2816 | Double a Number Represented as a Linked List | C++ Python | O(n) | O(1) | Medium | Linked List |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2104 | Sum of Subarray Ranges | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
2197 | Replace Non-Coprime Numbers in Array | C++ Python | O(nlogm) | O(1) | Hard | Stack, Math | |
2281 | Sum of Total Strength of Wizards | C++ Python | O(n) | O(n) | Hard | variant of Largest Rectangle in Histogram | Mono Stack, Prefix Sum |
2282 | Number of People That Can Be Seen in a Grid | C++ Python | O(m * n) | O(m + n) | Medium | ๐, variant of Number of Visible People in a Queue | Mono Stack |
2334 | Subarray With Elements Greater Than Varying Threshold | C++ Python | O(n) | O(n) | Hard | variant of Maximum Subarray Min-Product | Mono Stack |
2355 | Maximum Number of Books You Can Take | C++ Python | O(n) | O(n) | Hard | ๐ | Mono Stack, Math |
2454 | Next Greater Element IV | C++ Python | O(n) | O(n) | Hard | Mono Stack | |
2696 | Minimum String Length After Removing Substrings | C++ Python | O(n) | O(n) | Easy | Stack | |
2735 | Collecting Chocolates | C++ Python | O(n) | O(n) | Medium | Mono Stack, Difference Array, Prefix Sum, Binary Search, Mono Deque, Brute Force | |
2736 | Maximum Sum Queries | C++ Python | O(nlogn + mlogm + mlogn) | O(n + m) | Hard | Sort, Mono Stack, Binary Search | |
2764 | is Array a Preorder of Some โBinary Tree | C++ Python | O(n) | O(n) | Medium | ๐ | Stack |
2832 | Maximal Range That Each Element Is Maximum in It | C++ Python | O(n) | O(n) | Medium | ๐ | Mono Stack |
2863 | Maximum Length of Semi-Decreasing Subarrays | C++ Python | O(n) | O(n) | Medium | ๐ | Sort, Mono Stack |
2865 | Beautiful Towers I | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
2866 | Beautiful Towers II | C++ Python | O(n) | O(n) | Medium | Mono Stack | |
2899 | Last Visited Integers | C++ Python | O(n) | O(n) | Easy | Stack |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2398 | Maximum Number of Robots Within Budget | C++ Python | O(n) | O(n) | Hard | Mono Deque, Sliding Window, Two Pointers |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2054 | Two Best Non-Overlapping Events | C++ Python | O(nlogn) | O(n) | Medium | Line Sweep, Heap | |
2163 | Minimum Difference in Sums After Removal of Elements | C++ Python | O(nlogn) | O(n) | Hard | Heap, Prefix Sum | |
2208 | Minimum Operations to Halve Array Sum | C++ Python | O(nlogn) | O(n) | Medium | Heap | |
2386 | Find the K-Sum of an Array | C++ Python | O(nlogn + klogk) | O(n + k) | Hard | BFS, Heap | |
2402 | Meeting Rooms III | C++ Python | O(mlogm + n + mlogn) | O(n) | Hard | Heap | |
2462 | Total Cost to Hire K Workers | C++ Python | O(c + klogc) | O(c) | Medium | Heap, Two Pointers | |
2519 | Count the Number of K-Big Indices | C++ Python | O(nlogk) | O(n) | Hard | ๐ | Heap, Ordered Set, Sorted List |
2530 | Maximal Score After Applying K Operations | C++ Python | O(n + klogn) | O(1) | Medium | Heap, Simulation | |
2558 | Take Gifts From the Richest Pile | C++ Python | O(n + klogn) | O(1) | Easy | Heap, Simulation | |
2818 | Apply Operations to Maximize Score | C++ Python | O(sqrt(r) + n * (logr + sqrt(r)/log(sqrt(r))) + klogn) | O(sqrt(r) + n) | Hard | Number Theory, Linear Sieve of Eratosthenes , Mono Stack, Greedy, Sort, Heap |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2003 | Smallest Missing Genetic Value in Each Subtree | C++ Python | O(n) | O(n) | Hard | DFS, Stack | |
2096 | Step-By-Step Directions From a Binary Tree Node to Another | C++ Python | O(n) | O(h) | Medium | DFS, Stack | |
2179 | Count Good Triplets in an Array | C++ Python | O(nlogn) | O(n) | Hard | variant of Create Sorted Array through Instructions | BIT, Fenwick Tree |
2196 | Create Binary Tree From Descriptions | C++ Python | O(n) | O(n) | Medium | ||
2236 | Root Equals Sum of Children | C++ Python | O(1) | O(1) | Easy | Tree | |
2277 | Closest Node to Path in Tree | C++ Python | O(n + q) | O(n + q) | Hard | ๐ | Tree, BFS, Binary Lifting, Tarjan's Offline LCA Algorithm |
2421 | Number of Good Paths | C++ Python | O(nlogn) | O(n) | Hard | Sort, Union Find | |
2509 | Cycle Length Queries in a Tree | C++ Python | O(q * n) | O(1) | Hard | Tree, LCA | |
2846 | Minimum Edge Weight Equilibrium Queries in a Tree | C++ Python | O(r * (n + q)) | O(r * n + q) | Hard | Tree, Binary Lifting, Tarjan's Offline LCA Algorithm |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2001 | Number of Pairs of Interchangeable Rectangles | C++ Python | O(n) | O(n) | Medium | Math | |
2005 | Subtree Removal Game with Fibonacci Tree | C++ Python | O(1) | O(1) | Hard | ๐ | Math, Sprague-Grundy Theorem , Colon Principle |
2028 | Find Missing Observations | C++ Python | O(n) | O(1) | Medium | ||
2029 | Stone Game IX | C++ Python | O(n) | O(1) | Medium | ||
2063 | Vowels of All Substrings | C++ Python | O(n) | O(1) | Medium | Combinatorics | |
2073 | Time Needed to Buy Tickets | C++ Python | O(n) | O(1) | Easy | Simulation, Math | |
2083 | Substrings That Begin and End With the Same Letter | C++ Python | O(n) | O(1) | Medium | ๐ | Combinatorics |
2091 | Removing Minimum and Maximum From Array | C++ Python | O(n) | O(1) | Medium | Math | |
2110 | Number of Smooth Descent Periods of a Stock | C++ Python | O(n) | O(1) | Medium | Math, Combinatorics | |
2117 | Abbreviating the Product of a Range | C++ Python | O(r - l) | O(1) | Hard | Math | |
2119 | A Number After a Double Reversal | C++ Python | O(1) | O(1) | Easy | Math | |
2125 | Number of Laser Beams in a Bank | C++ Python | O(m * n) | O(1) | Medium | Math | |
2133 | Check if Every Row and Column Contains All Numbers | C++ Python | O(n^2) | O(n) | Easy | Math | |
2145 | Count the Hidden Sequences | C++ Python | O(n) | O(1) | Medium | Math | |
2148 | Count Elements With Strictly Smaller and Greater Elements | C++ Python | O(n) | O(1) | Easy | Math | |
2152 | Minimum Number of Lines to Cover Points | C++ Python | O(n * 2^n) | O(n^2) | Medium | ๐ | Math, Hash Table, Bitmasks |
2169 | Count Operations to Obtain Zero | C++ Python | O(log(min(m, n))) | O(1) | Easy | Math, Euclidean Algorithm |
|
2171 | Removing Minimum Number of Magic Beans | C++ Python | O(nlogn) | O(1) | Medium | Math, Sort | |
2176 | Count Equal and Divisible Pairs in an Array | C++ Python | O(nlogk + n * sqrt(k)) | O(n + sqrt(k)) | Easy | Math | |
2177 | Find Three Consecutive Integers That Sum to a Given Number | C++ Python | O(1) | O(1) | Medium | Math | |
2180 | Count Integers With Even Digit Sum | C++ Python | O(logn) | O(1) | Easy | Math | |
2183 | Count Array Pairs Divisible by K | C++ Python | O(nlogk + k) | O(sqrt(k)) | Hard | variant of Count Equal and Divisible Pairs in an Array | Math |
2198 | Number of Single Divisor Triplets | C++ Python | O(d^3) | O(d) | Medium | ๐ | Math, Combinatorics |
2217 | Find Palindrome With Fixed Length | C++ Python | O(n * l) | O(1) | Medium | Math | |
2221 | Find Triangular Sum of an Array | C++ Python | O(n) | O(1) | Medium | Simulation, Combinatorics, Number Thoery | |
2235 | Add Two Integers | C++ Python | O(1) | O(1) | Easy | Math | |
2240 | Number of Ways to Buy Pens and Pencils | C++ Python | O(sqrt(t)) | O(1) | Medium | Math | |
2244 | Minimum Rounds to Complete All Tasks | C++ Python | O(n) | O(n) | Medium | Math, Freq Table | |
2249 | Count Lattice Points Inside a Circle | C++ Python | O(n * r^2) | O(min(n * r^2, max_x * max_y)) | Medium | Math, Hash Table | |
2262 | Total Appeal of A String | C++ Python | O(n) | O(26) | Hard | variant of Count Unique Characters of All Substrings of a Given String | Combinatorics |
2280 | Minimum Lines to Represent a Line Chart | C++ Python | O(nlogn) | O(1) | Medium | Sort, Math, GCD | |
2310 | Sum of Numbers With Units Digit K | C++ Python | O(1) | O(1) | Medium | Math | |
2338 | Count the Number of Ideal Arrays | C++ Python | O(sqrt(m) + n + m * (logm + sqrt(m)/log(sqrt(m)))) | O(sqrt(m) + n + logm) | Hard | variant of Count Ways to Make Array With Product | DP, Linear Sieve of Eratosthenes , Factorization, Combinatorics |
2344 | Minimum Deletions to Make Array Divisible | C++ Python | O(n + m + logr) | O(1) | Hard | Math, GCD | |
2345 | Finding the Number of Visible Mountains | C++ Python | O(nlogn) | O(1) | Medium | ๐ | Math, Sort, Mono Stack |
2376 | Count Special Integers | C++ Python | O(logn) | O(logn) | Hard | variant of Numbers With Repeated Digits | Combinatorics |
2396 | Strictly Palindromic Number | C++ Python | O(1) | O(1) | Medium | Math | |
2400 | Number of Ways to Reach a Position After Exactly k Steps | C++ Python | O(k) | O(k) | Medium | Combinatorics | |
2409 | Count Days Spent Together | C++ Python | O(1) | O(1) | Easy | String, Math, Prefix Sum | |
2413 | Smallest Even Multiple | C++ Python | O(1) | O(1) | Easy | Math, Bit Manipulation | |
2427 | Number of Common Factors | C++ Python | O(log(min(a, b)) + sqrt(gcd)) | O(1) | Easy | Math | |
2437 | Number of Valid Clock Times | C++ Python | O(1) | O(1) | Easy | Combinatorics | |
2450 | Number of Distinct Binary Strings After Applying Operations | C++ Python | O(logn) | O(1) | Medium | ๐ | Combinatorics |
2455 | Average Value of Even Numbers That Are Divisible by Three | C++ Python | O(n) | O(1) | Easy | Math | |
2468 | Split Message Based on Limit | C++ Python | O(n + rlogr) | O(1) | Hard | Brute Force, Math | |
2469 | Convert the Temperature | C++ Python | O(1) | O(1) | Easy | Math | |
2481 | Minimum Cuts to Divide a Circle | C++ Python | O(1) | O(1) | Easy | Math | |
2485 | Find the Pivot Integer | C++ Python | O(1) | O(1) | Easy | Math | |
2514 | Count Anagrams | C++ Python | O(n) | O(n) | Hard | Math, Combinatorics | |
2520 | Count the Digits That Divide a Number | C++ Python | O(logn) | O(1) | Easy | Math | |
2521 | Distinct Prime Factors of Product of Array | C++ Python | precompute: O(sqrt(MAX_N)) runtime: O(m + nlog(logn)) |
O(sqrt(MAX_N)) | Medium | Number Theory, Linear Sieve of Eratosthenes |
|
2523 | Closest Prime Numbers in Range | C++ Python | precompute: O(MAX_N * log(MAX_N)) runtime: O(log(MAX_N)) |
O(MAX_N) | Medium | Number Theory, Linear Sieve of Eratosthenes , Segment Tree |
|
2525 | Categorize Box According to Criteria | C++ Python | O(1) | O(1) | Easy | Math | |
2539 | Count the Number of Good Subsequences | C++ Python | O(26 * n) | O(n) | Medium | ๐ | Combinatorics |
2543 | Check if Point Is Reachable | C++ Python | O(log(min(a, b))) | O(1) | Hard | Number Theory | |
2544 | Alternating Digit Sum | C++ Python | O(logn) | O(1) | Easy | Math | |
2549 | Count Distinct Numbers on Board | C++ Python | O(1) | O(1) | Easy | Math | |
2550 | Count Collisions of Monkeys on a Polygon | C++ Python | O(logn) | O(1) | Medium | Combinatorics, Fast Exponentiation | |
2562 | Find the Array Concatenation Value | C++ Python | O(nlogr) | O(1) | Easy | Math | |
2568 | Minimum Impossible OR | C++ Python | O(logr) | O(1) | Medium | Math, Hash Table, Bit Manipulations | |
2579 | Count Total Number of Colored Cells | C++ Python | O(1) | O(1) | Medium | Math | |
2582 | Pass the Pillow | C++ Python | O(1) | O(1) | Medium | Math | |
2584 | Split the Array to Make Coprime Products | C++ Python | O(n * sqrt(r)) | O(sqrt(r)) | Hard | Math, Number Theory | |
2614 | Prime In Diagonal | C++ Python | precompute: O(MAX_N) runtime: O(n) |
O(MAX_N) | Easy | Number Theory, Linear Sieve of Eratosthenes |
|
2651 | Calculate Delayed Arrival Time | C++ Python | O(1) | O(1) | Easy | Math | |
2652 | Sum Multiples | C++ Python | O(1) | O(1) | Easy | Math, Principle of Inclusion and Exclusion | |
2656 | Maximum Sum With Exactly K Elements | C++ Python | O(n) | O(1) | Easy | Math | |
2731 | Movement of Robots | C++ Python | O(nlogn) | O(1) | Medium | Sort, Math | |
2739 | Total Distance Traveled | C++ Python | O(1) | O(1) | Easy | Math | |
2749 | Minimum Operations to Make the Integer Zero | C++ Python | O(1) | O(1) | Medium | Linear Search, Bit Manipulations, Math | |
2750 | Ways to Split Array Into Good Subarrays | C++ Python | O(n) | O(1) | Medium | Combinatorics | |
2761 | Prime Pairs With Target Sum | C++ Python | O(n) | O(n) | Medium | Number Theory, Linear Sieve of Eratosthenes |
|
2778 | Sum of Squares of Special Elements | C++ Python | O(sqrt(n)) | O(1) | Easy | Number Theory | |
2780 | Minimum Index of a Valid Split | C++ Python | O(n) | O(1) | Medium | BoyerโMoore Majority Vote Algorithm , Linear Search |
|
2802 | Find The K-th Lucky Number | C++ Python | O(logn) | O(1) | Medium | ๐ | Math, Bitmasks |
2806 | Account Balance After Rounded Purchase | C++ Python | O(1) | O(1) | Easy | Math | |
2833 | Furthest Point From Origin | C++ Python | O(1) | O(1) | Easy | Math | |
2862 | Maximum Element-Sum of a Complete Subset of Indices | C++ Python | O(n) | O(n) | Hard | Number Theory, Basel Problem |
|
2861 | Maximum Number of Alloys | C++ Python | O(k * nlogn) | O(n) | Medium | Binary Search, Sort, Math | |
2894 | Divisible and Non-divisible Sums Difference | C++ Python | O(1) | O(1) | Easy | Math | |
2898 | Maximum Linear Stock Score | C++ Python | O(n) | O(n) | Medium | ๐ | Math, Freq Table |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2015 | Average Height of Buildings in Each Segment | C++ Python | O(nlogn) | O(n) | Medium | ๐ | Line Sweep |
2021 | Brightest Position on Street | C++ Python | O(nlogn) | O(n) | Medium | ๐ | Line Sweep |
2070 | Most Beautiful Item for Each Query | C++ Python | O(nlogn + qlogn) | O(1) | Medium | Sort, Binary Search | |
2089 | Find Target Indices After Sorting Array | C++ Python | O(n) | O(1) | Easy | Counting Sort | |
2158 | Amount of New Area Painted Each Day | C++ Python | O(nlogr) | O(r) | Hard | ๐ | Line Sweep, Sorted List, Heap, Segment Tree |
2164 | Sort Even and Odd Indices Independently | C++ Python | O(n) | O(c) | Easy | Counting Sort, Inplace | |
2191 | Sort the Jumbled Numbers | C++ Python | O(nlogm + nlogn) | O(n) | Medium | Sort | |
2231 | Largest Number After Digit Swaps by Parity | C++ Python | O(logn) | O(1) | Easy | Counting Sort | |
2233 | Maximum Product After K Increments | C++ Python | O(n + k) | O(n) | Medium | Heap, Freq Table, Sort, Math | |
2248 | Intersection of Multiple Arrays | C++ Python | O(n * l + r) | O(l) | Easy | Hash Table, Counting Sort | |
2251 | Number of Flowers in Full Bloom | C++ Python | O(nlogn + mlogn) | O(n) | Hard | Line Sweep, Binary Search | |
2343 | Query Kth Smallest Trimmed Number | C++ Python | O(q + n * t) | O(t + n + q) | Medium | Sort, Quick Select, Radix Sort | |
2418 | Sort the People | C++ Python | O(nlogn) | O(n) | Easy | Sort | |
2497 | Maximum Star Sum of a Graph | C++ Python | O(n) | O(n) | Medium | Sort, Quick Select | |
2512 | Reward Top K Students | C++ Python | O(pf * l + nf * l + n * l + klogk) | O(pf * l + nf * l + n) | Medium | Partial Sort, Quick Select | |
2545 | Sort the Students by Their Kth Score | C++ Python | O(mlogm) | O(1) | Medium | Sort | |
2659 | Make Array Empty | C++ Python | O(nlogn) | O(n) | Hard | Sort, BIT, Fenwick Tree | |
2679 | Sum in a Matrix | C++ Python | O(m * nlogn) | O(1) | Medium | Sort | |
2740 | Find the Value of the Partition | C++ Python | O(nlogn) | O(1) | Medium | Sort | |
2785 | Sort Vowels in a String | C++ Python | O(n) | O(1) | Medium | Counting Sort | |
2792 | Count Nodes That Are Great Enough | C++ Python | O(k * h) | O(k + h) | Hard | ๐ | Merge Sort |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2009 | Minimum Number of Operations to Make Array Continuous | C++ Python | O(nlogn) | O(1) | Hard | Two Pointers, Sliding Window | |
2024 | Maximize the Confusion of an Exam | C++ Python | O(n) | O(1) | Medium | variant of Longest Repeating Character Replacement | Sliding Window |
2040 | Kth Smallest Product of Two Sorted Arrays | C++ Python | O((m + n) * logr) | O(1) | Hard | Binary Search, Two Pointers | |
2046 | Sort Linked List Already Sorted Using Absolute Values | C++ Python | O(n) | O(1) | Medium | ๐ | Linked List |
2062 | Count Vowel Substrings of a String | C++ Python | O(n) | O(1) | Easy | variant of Count Number of Nice Subarrays | Sliding Window |
2067 | Number of Equal Count Substrings | C++ Python | O(n) | O(1) | Medium | ๐ | Sliding Window |
2090 | K Radius Subarray Averages | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
2105 | Watering Plants II | C++ Python | O(n) | O(1) | Medium | Simulation | |
2107 | Number of Unique Flavors After Sharing K Candies | C++ Python | O(n) | O(n) | Medium | ๐ | Sliding Window |
2134 | Minimum Swaps to Group All 1's Together II | C++ Python | O(n) | O(1) | Medium | Sliding Window | |
2149 | Rearrange Array Elements by Sign | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
2161 | Partition Array According to Given Pivot | C++ Python | O(n) | O(n) | Medium | Two Pointers | |
2200 | Find All K-Distant Indices in an Array | C++ Python | O(n) | O(1) | Easy | Two Pointers | |
2234 | Maximum Total Beauty of the Gardens | C++ Python | O(nlogn) | O(1) | Hard | Sort, Prefix Sum, Greedy, Binary Search, Two Pointers | |
2302 | Count Subarrays With Score Less Than K | C++ Python | O(n) | O(1) | Hard | Two Pointers, Sliding Window | |
2330 | Valid Palindrome IV | C++ Python | O(n) | O(1) | Medium | ๐ | String, Two Pointers |
2332 | The Latest Time to Catch a Bus | C++ Python | O(nlogn + mlogm) | O(1) | Medium | String, Two Pointers | |
2337 | Move Pieces to Obtain a String | C++ Python | O(n + m) | O(1) | Medium | String, Two Pointers | |
2348 | Number of Zero-Filled Subarrays | C++ Python | O(n) | O(1) | Medium | Two Pointers, Combinatorics | |
2379 | Minimum Recolors to Get K Consecutive Black Blocks | C++ Python | O(n) | O(1) | Easy | Sliding Window | |
2393 | Count Strictly Increasing Subarrays | C++ Python | O(n) | O(1) | Medium | ๐ | Two Pointers |
2401 | Longest Nice Subarray | C++ Python | O(n) | O(1) | Medium | Sliding Window, Two Pointers | |
2444 | Count Subarrays With Fixed Bounds | C++ Python | O(n) | O(1) | Hard | variant of Number of Substrings Containing All Three Characters | Two Pointers |
2461 | Maximum Sum of Distinct Subarrays With Length K | C++ Python | O(n) | O(k) | Medium | Two Pointers | |
2465 | Number of Distinct Averages | C++ Python | O(nlogn) | O(n) | Easy | Two Pointers, Hash Table | |
2511 | Maximum Enemy Forts That Can Be Captured | C++ Python | O(n) | O(1) | Easy | Array, Two Pointers | |
2516 | Take K of Each Character From Left and Right | C++ Python | O(n) | O(1) | Medium | Sliding Window, Two Pointers | |
2524 | Maximum Frequency Score of a Subarray | C++ Python | O(n) | O(n) | Hard | ๐ | Sliding Window, Two Pointers, Freq Table, Hash Table |
2537 | Count the Number of Good Subarrays | C++ Python | O(n) | O(n) | Medium | Sliding Window, Two Pointers | |
2540 | Minimum Common Value | C++ Python | O(n) | O(1) | Easy | Two Pointers | |
2555 | Maximize Win From Two Segments | C++ Python | O(n) | O(n) | Medium | Two Pointers, Sliding Window, DP | |
2563 | Count the Number of Fair Pairs | C++ Python | O(nlogn) | O(1) | Medium | Sort, Two Pointers | |
2570 | Merge Two 2D Arrays by Summing Values | C++ Python | O(n) | O(1) | Easy | Two Pointers | |
2609 | Find the Longest Balanced Substring of a Binary String | C++ Python | O(n) | O(1) | Easy | String, Two Pointers | |
2653 | Sliding Subarray Beauty | C++ Python | O(nlogk) | O(k) | Medium | Sorted List, Ordered Set, Two Pointers | |
2730 | Find the Longest Semi-Repetitive Substring | C++ Python | O(n) | O(1) | Medium | Two Pointers | |
2743 | Count Substrings Without Repeating Character | C++ Python | O(n) | O(1) | Medium | ๐, variant of Longest Substring Without Repeating Characters | Two Pointers, Sliding Window |
2747 | Count Zero Request Servers | C++ Python | O(nlogn + mlogm) | O(n + m) | Hard | Sort, Two Pointers, Line Sweep | |
2762 | Continuous Subarrays | C++ Python | O(n) | O(1) | Medium | Mono Deque, BST, Ordered Dict, Two Pointers, Sliding Window | |
2763 | Sum of Imbalance Numbers of All Subarrays | C++ Python | O(n) | O(n) | Hard | Two Pointers, Sliding Window, Hash Table, Combinatorics | |
2779 | Maximum Beauty of an Array After Applying Operation | C++ Python | O(nlogn) | O(1) | Medium | Sort, Two Pointers, Sliding Window | |
2781 | Length of the Longest Valid Substring | C++ Python | O((m + n) * l) | O(t) | Hard | Two Pointers, Sliding Window, Trie | |
2799 | Count Complete Subarrays in an Array | C++ Python | O(n) | O(n) | Medium | Freq Table, Two Pointers, Sliding Window | |
2824 | Count Pairs Whose Sum is Less than Target | C++ Python | O(nlogn) | O(1) | Easy | Sort, Two Pointers | |
2831 | Find the Longest Equal Subarray | C++ Python | O(n) | O(n) | Medium | Freq Table, Two Pointers, Sliding Window | |
2838 | Maximum Coins Heroes Can Collect | C++ Python | O(nlogn + mlogm) | O(n + m) | Medium | ๐ | Sort, Two Pointers |
2841 | Maximum Sum of Almost Unique Subarray | C++ Python | O(n) | O(n) | Medium | Freq Table, Two Pointers, Sliding Window | |
2875 | Minimum Size Subarray in Infinite Array | C++ Python | O(n) | O(1) | Medium | Prefix Sum, Hash Table, Two Pointers, Sliding Window | |
2904 | Shortest and Lexicographically Smallest Beautiful String | C++ Python | O(n^2) | O(1) | Medium | Two Pointers, Sliding Window |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2613 | Beautiful Pairs | C++ Python | O(n) on average | O(n) | Hard | ๐, variant of SPOJ - Closest Point Pair | Random Algorithms, Divide and Conquer, Merge Sort, Segment Tree |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2064 | Minimized Maximum of Products Distributed to Any Store | C++ Python | O(nlogm) | O(1) | Medium | variant of Minimum Limit of Balls in a Bag | |
2111 | Minimum Operations to Make the Array K-Increasing | C++ Python | O(nlog(n/k)) | O(n/k) | Hard | variant of Longest Increasing Subsequence | |
2137 | Pour Water Between Buckets to Make Water Levels Equal | C++ Python | O(nlogr) | O(1) | Medium | ๐ | |
2187 | Minimum Time to Complete Trips | C++ Python | O(nlogr) | O(1) | Medium | ||
2226 | Maximum Candies Allocated to K Children | C++ Python | O(nlogr) | O(1) | Medium | Binary Search | |
2250 | Count Number of Rectangles Containing Each Point | C++ Python | O(nlogn + m * max_y * logn) | O(n) | Medium | Bucket Sort, Binary Search | |
2300 | Successful Pairs of Spells and Potions | C++ Python | O(mlogm + nlogm) | O(1) | Medium | Binary Search | |
2333 | Minimum Sum of Squared Difference | C++ Python | O(nlogn + nlogr) | O(1) | Medium | Binary Search | |
2387 | Median of a Row Wise Sorted Matrix | C++ Python | O(logr * mlogn) | O(1) | Medium | ๐ | Binary Search |
2389 | Longest Subsequence With Limited Sum | C++ Python | O(nlogn + qlogn) | O(1) | Easy | Greedy, Sort, Binary Search | |
2448 | Minimum Cost to Make Array Equal | C++ Python | O(nlogn) | O(n) | Hard | Math, Binary Search, Prefix Sum | |
2476 | Closest Nodes Queries in a Binary Search Tree | C++ Python | O(n + qlogn) | O(n) | Hard | DFS, Binary Search | |
2513 | Minimize the Maximum of Two Arrays | C++ Python | O(log(min(d1, d2))) | O(1) | Medium | Number Theory, Binary Search | |
2517 | Maximum Tastiness of Candy Basket | C++ Python | O(nlogr) | O(1) | Medium | Binary Search, Greedy | |
2528 | Maximize the Minimum Powered City | C++ Python | O(nlogk) | O(n) | Hard | Binary Search, Sliding Window, Greedy | |
2529 | Maximum Count of Positive Integer and Negative Integer | C++ Python | O(logn) | O(1) | Easy | Binary Search | |
2554 | Maximum Number of Integers to Choose From a Range I | C++ Python | O(b) | O(b) | Medium | Math, Binary Search, Prefix Sum, Greedy | |
2557 | Maximum Number of Integers to Choose From a Range II | C++ Python | O(b) | O(b) | Medium | ๐ | Math, Binary Search, Prefix Sum |
2560 | House Robber IV | C++ Python | O(nlogn) | O(n) | Medium | Binary Search, Greedy | |
2594 | Minimum Time to Repair Cars | C++ Python | O(mx * (logc + log(mn))) | O(mx) | Medium | Freq Table, Binary Search, Heap, Simulation | |
2602 | Minimum Operations to Make All Array Elements Equal | C++ Python | O(nlogn + qlogn) | O(n) | Medium | Sort, Binary Search, Prefix Sum | |
2616 | Minimize the Maximum Difference of Pairs | C++ Python | O(nlogn + nlogr) | O(1) | Medium | Sort, Binary Search, Greedy | |
2702 | Minimum Operations to Make Numbers Non-positive | C++ Python | O(nlogr) | O(1) | Hard | ๐ | Binary Search, Greedy |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2426 | Number of Pairs Satisfying Inequality | C++ Python | O(nlogn) | O(n) | Hard | Merge Sort, Two Pointers, BIT, Fenwick Tree, Coordinate Compression, Sorted List, Ordered Set, Binary Search | |
2689 | Extract Kth Character From The Rope Tree | C++ Python | O(h) | O(1) | Medium | ๐ | BST |
2817 | Minimum Absolute Difference Between Elements With Constraint | C++ Python | O(nlogn) | O(n) | Medium | Sorted List, BST, Binary Search |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2039 | The Time When the Network Becomes Idle | C++ Python | O(|E|) | O(|E|) | Medium | Math | |
2045 | Second Minimum Time to Reach Destination | C++ Python | O(|E|) | O(|E|) | Hard | Bi-BFS | |
2050 | Parallel Courses III | C++ Python | O(|V| + |E|) | O(|E|) | Hard | variant of Parallel Courses | Topological Sort |
2059 | Minimum Operations to Convert Number | C++ Python | O(m * n) | O(m) | Medium | ||
2115 | Find All Possible Recipes from Given Supplies | C++ Python | O(|E|) | O(|E|) | Medium | Topological Sort | |
2146 | K Highest Ranked Items Within a Price Range | C++ Python | O(m * n + klogk) | O(m * n) | Medium | BFS, Quick Select, Sort | |
2258 | Escape the Spreading Fire | C++ Python | O(m * n) | O(m * n) | Hard | BFS | |
2290 | Minimum Obstacle Removal to Reach Corner | C++ Python | O(m * n) | O(m * n) | Hard | variant of Minimum Cost to Make at Least One Valid Path in a Grid | A* Search Algorithm , 0-1 BFS, Deque |
2316 | Count Unreachable Pairs of Nodes in an Undirected Graph | C++ Python | O(n) | O(n) | Medium | Flood Fill, BFS, Math | |
2368 | Reachable Nodes With Restrictions | C++ Python | O(n) | O(n) | Medium | BFS | |
2415 | Reverse Odd Levels of Binary Tree | C++ Python | O(n) | O(n) | Medium | BFS | |
2471 | Minimum Number of Operations to Sort a Binary Tree by Level | C++ Python | O(nlogn) | O(w) | Medium | Sort, BFS | |
2492 | Minimum Score of a Path Between Two Cities | C++ Python | O(n + m) | O(n + m) | Medium | BFS | |
2493 | Divide Nodes Into the Maximum Number of Groups | C++ Python | O(n^2) | O(n) | Medium | variant of Is Graph Bipartite? | BFS, DFS |
2503 | Maximum Number of Points From Grid Queries | C++ Python | O((m * n + q) * log(m * n)) | O(m * n) | Hard | BFS, Heap, Prefix Sum, Binary Search | |
2577 | Minimum Time to Visit a Cell In a Grid | C++ Python | O(m * n * log(m * n)) | O(m * n) | Hard | Dijkstra's Algorithm |
|
2583 | Kth Largest Sum in a Binary Tree | C++ Python | O(n) | O(n) | Medium | BFS, Quick Select | |
2603 | Collect Coins in a Tree | C++ Python | O(n) | O(n) | Hard | Tree, BFS | |
2612 | Minimum Reverse Operations | C++ Python | O(n) | O(n) | Hard | BFS, Union Find, BST, Sorted List | |
2617 | Minimum Number of Visited Cells in a Grid | C++ Python | O(m * n) | O(m * n) | Hard | variant of Minimum Reverse Operations | BFS, Union Find, BST, Sorted List |
2641 | Cousins in Binary Tree II | C++ Python | O(n) | O(w) | Medium | BFS | |
2658 | Maximum Number of Fish in a Grid | C++ Python | O(m * n) | O(m + n) | Medium | BFS, DFS | |
2685 | Count the Number of Complete Components | C++ Python | O(n) | O(n) | Medium | BFS | |
2709 | Greatest Common Divisor Traversal | C++ Python | precompute: O(sqrt(r)) runtime: O(n * (logr + sqrt(r)/log(sqrt(r)))) |
O(sqrt(r) + nlogr) | Hard | Linear Sieve of Eratosthenes , Factorization, BFS |
|
2812 | Find the Safest Path in a Grid | C++ Python | O(n^2) | O(n^2) | Medium | BFS, Bucket Sort, Union Find, Dijkstra's Algorithm , Binary Search |
|
2814 | Minimum Time Takes to Reach Destination Without Drowning | C++ Python | O(m * n) | O(m * n) | Hard | ๐ | Simulation, BFS |
2852 | Sum of Remoteness of All Cells | C++ Python | O(n^2) | O(n^2) | Medium | ๐ | Flood Fill, BFS, Math |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2014 | Longest Subsequence Repeated k Times | C++ Python | O(n * (n/k)!) | O(n/k) | Hard | ||
2056 | Number of Valid Move Combinations On Chessboard | C++ Python | O(1) | O(1) | Hard | ||
2094 | Finding 3-Digit Even Numbers | C++ Python | O(n) | O(1) | Easy | ||
2443 | Sum of Number and Its Reverse | C++ Python | O(n^(1/(2*log2(10)))) | O(log10(n)/2) | Medium | Brute Force, Backtracking | |
2664 | The Knightโs Tour | C++ Python | O(m * n) | O(1) | Medium | ๐ | Backtracking, Greedy, Warnsdorff's Rule |
2698 | Find the Punishment Number of an Integer | C++ Python | O(n * (logn)^(2*logn)) | O(logn) | Medium | Backtracking | |
2741 | Special Permutations | C++ Python | O(n^2 * 2^n) | O(n * 2^n) | Medium | Backtracking, Memoization |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2076 | Process Restricted Friend Requests | C++ Python | O(n * r) | O(n) | Hard | Union Find | |
2077 | Paths in Maze That Lead to Same Room | C++ Python | O(|V|^3) | O(|E|) | Medium | ๐ | |
2092 | Find All People With Secret | C++ Python | O(nlogn) | O(nlogn) | Hard | BFS, DFS, Union Find | |
2093 | Minimum Path Cost in a Hidden Grid | C++ Python | O(|E| * log|V|) | O(|V| + |E|) | Medium | variant of Cheapest Flights Within K Stops, ๐ | Dijkstra's Algorithm , DP |
2097 | Valid Arrangement of Pairs | C++ Python | O(|V| + |E|) | O(|V| + |E|) | Hard | variant of Reconstruct Itinerary | Hierholzer's Algorithm , Eulerian Path |
2123 | Minimum Operations to Remove Adjacent Ones in Matrix | C++ Python | O(m * n * sqrt(m * n)) | O(m + n) | Hard | variant of Maximum Students Taking Exam, ๐ | Hopcroft-Karp Bipartite Matching , Maximum Independent Set |
2127 | Maximum Employees to Be Invited to a Meeting | C++ Python | O(n) | O(n) | Hard | ||
2172 | Maximum AND Sum of Array | C++ Python | O(n^3) | O(n^2) | Hard | variant of Maximum Compatibility Score Sum | DP, Hungarian Weighted Bipartite Matching |
2203 | Minimum Weighted Subgraph With the Required Paths | C++ Python | O(|E| * log|V|) | O(|E|) | Hard | Dijkstra's Algorithm |
|
2204 | Distance to a Cycle in Undirected Graph | C++ Python | O(|V| + |E|) | O(|V| + |E|) | Hard | ๐ | Graph, DFS, BFS |
2242 | Maximum Score of a Node Sequence | C++ Python | O(|V| + |E|) | O(|V|) | Hard | Graph | |
2307 | Check for Contradictions in Equations | C++ Python | O(e + q) | O(n) | Hard | ๐, variant of Evaluate Division | DFS, Union Find |
2359 | Find Closest Node to Given Two Nodes | C++ Python | O(n) | O(n) | Medium | Graph, Hash Table, DFS | |
2360 | Longest Cycle in a Graph | C++ Python | O(n) | O(n) | Hard | Graph, Hash Table, DFS | |
2392 | Build a Matrix With Conditions | C++ Python | O(k^2 + r + c) | O(k + r + c) | Hard | Graph, Topological Sort | |
2473 | Minimum Cost to Buy Apples | C++ Python | O(n * rlogn) | O(n) | Medium | ๐ | Dijkstra's Algorithm |
2508 | Add Edges to Make Degrees of All Nodes Even | C++ Python | O(n) | O(n) | Hard | Graph | |
2608 | Shortest Cycle in a Graph | C++ Python | O(n^2) | O(n + e) | Hard | Graph, BFS | |
2662 | Minimum Cost of a Path With Special Roads | C++ Python | O(n^2) | O(n^2) | Medium | Graph, Dijkstra's Algorithm |
|
2699 | Modify Graph Edge Weights | C++ Python | O(|E| * log|V|) | O(|E|) | Hard | Graph, Dijkstra's Algorithm |
|
2714 | Find Shortest Path with K Hops | C++ Python | O(n * k + (k * e) * log(n * k)) | O(n * k + e) | Hard | ๐ | Graph, Dijkstra's Algorithm |
2737 | Find the Closest Marked Node | C++ Python | O(|E| * log|V|) | O(|E|) | Medium | ๐ | Graph, Dijkstra's Algorithm |
2836 | Maximize Value of Function in a Ball Passing Game | C++ Python | O(n) | O(n) | Hard | Graph, Prefix Sum, Two Pointers, Sliding Window, Binary Lifting | |
2850 | Minimum Moves to Spread Stones Over Grid | C++ Python | O(n^3) | O(n^2) | Medium | Backtracking, Hungarian Weighted Bipartite Matching |
|
2876 | Count Visited Nodes in a Directed Graph | C++ Python | O(n) | O(n) | Hard | Graph, Hash Table, Stack |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2101 | Detonate the Maximum Bombs | C++ Python | O(|V|^2 + \V| * |E|) | O(\V| + |E|) | Medium | Graph, DFS, BFS |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2061 | Number of Spaces Cleaning Robot Cleaned | C++ Python | O(m * n) | O(1) | Medium | ๐ | |
2162 | Minimum Cost to Set Cooking Time | C++ Python | O(1) | O(1) | Medium | ||
2257 | Count Unguarded Cells in the Grid | C++ Python | O(m * n) | O(m * n) | Medium | Array, Simulation | |
2303 | Calculate Amount Paid in Taxes | C++ Python | O(n) | O(1) | Easy | Simulation | |
2507 | Smallest Value After Replacing With Sum of Prime Factors | C++ Python | O(s * logn) | O(max_n^0.5) | Medium | Number Theory, Simulation | |
2532 | Time to Cross a Bridge | C++ Python | O(k + nlogk) | O(k) | Hard | Heap, Simulation | |
2534 | Time Taken to Cross the Door | C++ Python | O(n) | O(n) | Hard | ๐ | Queue, Simulation |
2593 | Find Score of an Array After Marking All Elements | C++ Python | O(nlogn) | O(n) | Medium | Simulation, Sort, Hash Table | |
2596 | Check Knight Tour Configuration | C++ Python | O(m * n) | O(m * n) | Medium | Simulation, Hash Table | |
2682 | Find the Losers of the Circular Game | C++ Python | O(n) | O(n) | Easy | Hash Table, Simulation | |
2751 | Robot Collisions | C++ Python | O(nlogn) | O(n) | Hard | Sort, Simulation, Stack |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2202 | Maximize the Topmost Element After K Moves | C++ Python | O(min(n, k)) | O(1) | Medium | Constructive Algorithms | |
2335 | Minimum Amount of Time to Fill Cups | C++ Python | O(1) | O(1) | Easy | Math, Constructive Algorithms | |
2350 | Shortest Impossible Sequence of Rolls | C++ Python | O(n) | O(k) | Hard | Constructive Algorithms | |
2546 | Apply Bitwise Operations to Make Strings Equal | C++ Python | O(n) | O(1) | Medium | Constructive Algorithms | |
2358 | Maximum Number of Groups Entering a Competition | C++ Python | O(1) | O(1) | Medium | Constructive Algorithms, Math | |
2610 | Convert an Array Into a 2D Array With Conditions | C++ Python | O(n) | O(n) | Medium | Freq Table, Constructive Algorithms | |
2647 | Color the Triangle Red | C++ Python | O(n^2) | O(1) | Hard | ๐ | Constructive Algorithms |
2654 | Minimum Number of Operations to Make All Array Elements Equal to 1 | C++ Python | O(n^2) | O(1) | Medium | Math, Number Theory, Constructive Algorithms | |
2728 | Count Houses in a Circular Street | C++ Python | O(k) | O(1) | Easy | ๐ | Constructive Algorithms |
2732 | Find a Good Subset of the Matrix | C++ Python | O(m * 2^n) | O(2^n) | Hard | Bitmasks, Constructive Algorithms, Greedy | |
2745 | Construct the Longest New String | C++ Python | O(1) | O(1) | Medium | Constructive Algorithms, Math | |
2753 | Count Houses in a Circular Street II | C++ Python | O(k) | O(1) | Hard | ๐ | Constructive Algorithms |
2811 | Check if it is Possible to Split Array | C++ Python | O(n) | O(1) | Medium | Constructive Algorithms | |
2829 | Determine the Minimum Sum of a k-avoiding Array | C++ Python | O(1) | O(1) | Medium | Greedy, Constructive Algorithms, Math | |
2834 | Find the Minimum Possible Sum of a Beautiful Array | C++ Python | O(1) | O(1) | Medium | Determine the Minimum Sum of a k-avoiding Array | Greedy, Constructive Algorithms, Math |
2849 | Determine if a Cell Is Reachable at a Given Time | C++ Python | O(1) | O(1) | Medium | Constructive Algorithms, Math | |
2856 | Minimum Array Length After Pair Removals | C++ Python | O(n) | O(n) | Medium | Freq Table, Constructive Algorithms |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2013 | Detect Squares | C++ Python | ctor: O(1) add: O(1) count: O(n) |
O(n) | Medium | ||
2034 | Stock Price Fluctuation | C++ Python | ctor: O(1) update: O(logn) current: O(1) max: O(1) min: O(1) |
O(n) | Medium | Sorted List, Heap | |
2043 | Simple Bank System | C++ Python | ctor: O(1) transer: O(1) deposit: O(1) withdraw: O(1) |
O(1) | Medium | ||
2069 | Walking Robot Simulation II | C++ Python | O(1) | O(1) | Medium | Simulation, Math | |
2080 | Range Frequency Queries | C++ Python | ctor: O(n) query: O(logn) |
O(n) | Medium | Binary Search | |
2102 | Sequentially Ordinal Rank Tracker | C++ Python | add: O(logn) get: O(logn) |
O(n) | Hard | Sorted List | |
2166 | Design Bitset | C++ Python | ctor: O(n) fix: O(1) fix: O(1) unfix: O(1) flip: O(1) all: O(1) one: O(1) count: O(1) toString: O(n) |
O(n) | Medium | ||
2227 | Encrypt and Decrypt Strings | C++ Python | ctor: O(m + d) encrypt: O(n) decrypt: O(n) |
O(n) | Hard | Freq Table | |
2241 | Design an ATM Machine | C++ Python | ctor: O(1) deposit: O(1) withdraw: O(1) |
O(1) | Medium | Greedy | |
2254 | Design Video Sharing Platform | C++ Python | ctor: O(1) upload: O(logn + l) remove: O(logn) like: O(1) dislike: O(1) view: O(1) getLikesAndDislikes: O(1) getViews: O(1) |
O(n * l) | Hard | ๐ | Heap |
2276 | Count Integers in Intervals | C++ Python | ctor: O(1) add: O(logn), amortized Count: O(1) |
O(n) | Hard | Sorted List | |
2286 | Booking Concert Tickets in Groups | C++ Python | ctor: O(n) gather: O(logn) scatter: O(logn), amortized |
O(n) | Hard | Segment Tree, Binary Search | |
2296 | Design a Text Editor | C++ Python | ctor: O(1) addText: O(l) deleteText: O(k) cursorLeft: O(k) cursorRight: O(k) |
O(n) | Hard | Stack | |
2336 | Smallest Number in Infinite Set | C++ Python | ctor: O(1) popSmallest: O(logn) addBack: O(logn) |
O(n) | Medium | Heap, BST | |
2349 | Design a Number Container System | C++ Python | ctor: O(1) change: O(logn) find: O(1) |
O(n) | Medium | Sorted List, BST | |
2353 | Design a Food Rating System | C++ Python | ctor: O(nlogn) changeRating: O(logn) highestRated: O(1) |
O(n) | Medium | Sorted List, BST | |
2408 | Design SQL | C++ Python | ctor: O(t * max_m) insertRow: O(m) deleteRow: O(1) selectCell: O(m) |
O(d) | Medium | ๐ | Hash Table |
2424 | Longest Uploaded Prefix | C++ Python | ctor: O(1) upload: O(1), amortized longest: O(1) |
O(n) | Medium | Hash Table | |
2502 | Design Memory Allocator | C++ Python | ctor: O(1) allocate: O(logn) free: O(logn) |
O(n) | Medium | Sorted List | |
2526 | Find Consecutive Integers from a Data Stream | C++ Python | O(1) | O(1) | Medium | Array | |
2590 | Design a Todo List | C++ Python | ctor: O(1) addTask: O(l + logn) getAllTasks: O(r) getTasksForTag: O(r * c) completeTask: O(l + logn) |
O(n * l) | Medium | ๐ | BST, Sorted List |
2642 | Design Graph With Shortest Path Calculator | C++ Python | ctor: O(|V| + |E|) addEdge: O(1) shortestPath: O(|E| * log|V|) |
O(|E|) | Hard | Dijkstra's Algorithm |
|
2671 | Frequency Tracker | C++ Python | ctor: O(1) add: O(1) deleteOne: O(1) hasFrequency: O(1) |
O(min(n, r)) | Medium | Freq Table |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2618 | Check if Object Instance of Class | TypeScript | O(n) | O(1) | Medium | ||
2619 | Array Prototype Last | TypeScript | O(1) | O(1) | Easy | ||
2620 | Counter | TypeScript | O(1) | O(1) | Easy | ||
2621 | Sleep | TypeScript | O(1) | O(1) | Easy | Promise | |
2622 | Cache With Time Limit | TypeScript | O(1) | O(1) | Medium | Hash Table | |
2623 | Memoize | TypeScript | O(1) | O(1) | Medium | Hash Table | |
2624 | Snail traversal | TypeScript | O(m * n) | O(1) | Medium | ||
2625 | Flatten Deeply Nested Array | TypeScript | O(n) | O(h) | Medium | DFS | |
2626 | Array Reduce Transformation | TypeScript | O(n) | O(1) | Easy | ||
2627 | Debounce | TypeScript | O(1) | O(1) | Medium | ||
2628 | JSON Deep Equal | TypeScript | O(n) | O(h) | Medium | DFS | |
2629 | Function Composition | TypeScript | O(n) | O(1) | Easy | ||
2630 | Memoize II | TypeScript | O(n) | O(t) | Hard | Trie | |
2631 | Group By | TypeScript | O(n) | O(1) | Medium | ||
2632 | Curry | TypeScript | O(n) | O(n) | Medium | ||
2633 | Convert Object to JSON String | TypeScript | O(n) | O(h) | Medium | DFS | |
2634 | Filter Elements from Array | TypeScript | O(n) | O(1) | Easy | ||
2635 | Apply Transform Over Each Element in Array | TypeScript | O(n) | O(1) | Easy | ||
2636 | Promise Pool | TypeScript | O(c + n / c) | O(c) | Medium | Promise | |
2637 | Promise Time Limit | TypeScript | O(n) | O(1) | Easy | Promise | |
2648 | Generate Fibonacci Sequence | TypeScript | O(1) | O(1) | Easy | DP | |
2649 | Nested Array Generator | TypeScript | O(1) | O(d) | Medium | DFS | |
2650 | Design Cancellable Function | TypeScript | O(1) | O(1) | Hard | Promise | |
2665 | Counter II | TypeScript | ctor: O(1) increment: O(1) decrement: O(1) reset: O(1) |
O(1) | Easy | ||
2666 | Allow One Function Call | TypeScript | O(1) | O(1) | Easy | ||
2667 | Create Hello World Function | TypeScript | O(1) | O(1) | Easy | ||
2675 | Array of Objects to Matrix | TypeScript | O(l * mlogm + m * n) | O(l * m + m * n) | Medium | DFS | |
2676 | Throttle | TypeScript | O(1) | O(1) | Medium | ||
2677 | Chunk Array | TypeScript | O(n) | O(1) | Easy | ||
2690 | Infinite Method Object | TypeScript | O(1) | O(1) | Medium | ๐ | Proxy |
2691 | Immutability Helper | TypeScript | O(1) | O(1) | Hard | ๐ | Proxy |
2692 | Make Object Immutable | TypeScript | O(1) | O(1) | Medium | ๐ | Proxy |
2693 | Call Function with Custom Context | TypeScript | O(1) | O(1) | Medium | Symbol | |
2694 | Event Emitter | TypeScript | subscribe: O(1) unsubscribe: O(1) emit: O(n) |
O(n) | Medium | Ordered Set | |
2695 | Array Wrapper | TypeScript | valueOf: O(n) toString: O(n) |
O(1) | Easy | ||
2700 | Differences Between Two Objects | TypeScript | O(n) | O(h) | Medium | DFS | |
2703 | Return Length of Arguments Passed | TypeScript | O(1) | O(1) | Easy | ||
2704 | To Be Or Not To Be | TypeScript | O(1) | O(1) | Easy | ||
2705 | Compact Object | TypeScript | O(n) | O(h) | Medium | DFS | |
2715 | Execute Cancellable Function With Delay | TypeScript | O(1) | O(1) | Easy | ||
2721 | Execute Asynchronous Functions in Parallel | TypeScript | O(n) | O(n) | Medium | Promise | |
2722 | Join Two Arrays by ID | TypeScript | O(mlogm + nlogn) | O(1) | Medium | Sort, Two Pointers | |
2723 | Add Two Promises | TypeScript | O(1) | O(1) | Easy | Promise | |
2724 | Sort By | TypeScript | O(nlogn) | O(1) | Easy | Sort | |
2725 | Interval Cancellation | TypeScript | O(1) | O(1) | Easy | ||
2726 | Calculator with Method Chaining | TypeScript | O(1) | O(1) | Easy | ||
2727 | Is Object Empty | TypeScript | O(1) | O(1) | Easy | ||
2754 | Bind Function to Context | TypeScript | O(1) | O(1) | Medium | ๐ | Symbol |
2755 | Deep Merge of Two Objects | TypeScript | O(n + m) | O(h) | Medium | ๐ | DFS |
2756 | Query Batching | TypeScript | O(n) | O(n) | Hard | ๐ | |
2757 | Generate Circular Array Values | TypeScript | O(1) | O(1) | Medium | ๐ | Generator |
2758 | Next Day | TypeScript | O(1) | O(1) | Easy | ๐ | |
2759 | Convert JSON String to Object | TypeScript | O(n) | O(h) | Hard | ๐ | Stack |
2774 | Array Upper Bound | TypeScript | O(logn) | O(1) | Easy | ๐ | Binary Search |
2775 | Undefined to Null | TypeScript | O(n) | O(h) | Medium | ๐ | DFS |
2776 | Convert Callback Based Function to Promise Based Function | TypeScript | O(1) | O(1) | Medium | ๐ | Promise |
2777 | Date Range Generator | TypeScript | O(1) | O(1) | Medium | ๐ | Generator |
2794 | Create Object from Two Arrays | TypeScript | O(n) | O(1) | Easy | ๐ | |
2795 | Parallel Execution of Promises for Individual Results Retrieval | TypeScript | O(n) | O(n) | Medium | ๐ | Promise |
2796 | Repeat String | TypeScript | O(n * t) | O(n * t) | Easy | ๐ | String |
2797 | Partial Function with Placeholders | TypeScript | O(n) | O(n) | Medium | ๐ | |
2803 | Factorial Generator | TypeScript | O(n) | O(1) | Easy | ๐ | Generator |
2804 | Array Prototype ForEach | TypeScript | O(n) | O(1) | Easy | ๐ | Symbol |
2805 | Custom Interval | TypeScript | O(1) | O(1) | Medium | ๐ | |
2821 | Delay the Resolution of Each Promise | TypeScript | O(1) | O(1) | Easy | ๐ | Promise |
2822 | Inversion of Object | TypeScript | O(n) | O(1) | Easy | ๐ | |
2823 | Deep Object Filter | TypeScript | O(n) | O(h) | Medium | ๐ | DFS |
# | Title | Solution | Time | Space | Difficulty | Tag | Note |
---|---|---|---|---|---|---|---|
2877 | Create a DataFrame from List | Python3 | O(n) | O(1) | Easy | ||
2878 | Get the Size of a DataFrame | Python3 | O(1) | O(1) | Easy | ||
2879 | Display the First Three Rows | Python3 | O(1) | O(1) | Easy | ||
2880 | Select Data | Python3 | O(n) | O(n) | Easy | ||
2881 | Create a New Column | Python3 | O(n) | O(1) | Easy | ||
2882 | Drop Duplicate Rows | Python3 | O(n) | O(n) | Easy | ||
2883 | Drop Missing Data | Python3 | O(n) | O(1) | Easy | ||
2884 | Modify Columns | Python3 | O(n) | O(1) | Easy | ||
2885 | Rename Columns | Python3 | O(n) | O(1) | Easy | ||
2886 | Change Data Type | Python3 | O(n) | O(1) | Easy | ||
2887 | Fill Missing Data | Python3 | O(n) | O(1) | Easy | ||
2888 | Reshape Data: Concatenate | Python3 | O(n + m) | O(1) | Easy | ||
2889 | Reshape Data: Pivot | Python3 | O(n) | O(1) | Easy | ||
2890 | Reshape Data: Melt | Python3 | O(n) | O(1) | Easy | ||
2891 | Method Chaining | Python3 | O(nlogn) | O(n) | Easy |