• Stars
    star
    227
  • Rank 175,900 (Top 4 %)
  • Language
    C++
  • Created over 5 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The repository contains solutions to various problems on leetcode. The code is merely a snippet (as solved on LeetCode) & hence is not executable in a c++ compiler. The code written is purely original and completely my own.

LeetCode-Topicwise-Solutions

My solutions to algorithmic problems in leetcode written in C++ and Python

What you can find in this repository

I have solved quite a number of problems from several topics. See the below table for further details.

How to contribute?

  1. Fork the repository
  2. Do the desired changes (add/delete/modify)
  3. Make a pull request

When to contribute?

  1. If there is no solution to a problem in the main branch.
  2. If your solution is asymptotically faster than the one in the main branch.
  3. If your algorithm is of the same time complexity but with reduced code size. In this case, comment out the original solution and make a pull request with your solution.
  4. If you have another method of solving the problem which is asymptotically slower than the original method then, comment your solution in the main file and make a pull request.

What I'll be doing with this repository

One day in the foreseeable future I will have solved all the challenges on leetcode. Then this repository will mostly become a static one.

Constructive criticisms or code reviews of any kind are very much welcome.

If you have any questions about the solutions you can find here, feel free to contact me [email protected].

Algorithms

Database

Shell

Reference


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(n×2n/2) Meet in the Middle
20 O(n×2n) Backtracking / Generating 2n Subsets / Bitmask Technique
11 O(n!) Factorial / Permutation / Combination Algorithm

Bit Manipulation

# Title Solution Time Space Difficulty Tag Note
1310 XOR Queries of a Subarray C++ Python O(n) O(1) Medium
1318 Minimum Flips to Make a OR b Equal to c C++ Python O(1) O(1) Medium
1342 Number of Steps to Reduce a Number to Zero C++ Python O(logn) O(1) Easy
1558 Minimum Numbers of Function Calls to Make Target Array C++ Python O(nlogn) O(1) Medium Greedy
1707 Maximum XOR With an Element From Array C++ Python O(nlogn + mlogm + nlogk + mlogk) O(nlogk) Hard variant of Maximum XOR of Two Numbers in an Array Greedy, Trie
1720 Decode XORed Array C++ Python O(n) O(1) Easy
1734 Decode XORed Permutation C++ Python O(n) O(1) Medium
1829 Maximum XOR for Each Query C++ Python O(n) O(1) Medium
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


Array

# Title Solution Time Space Difficulty Tag Note
1002 Find Common Characters C++ Python O(n * l) O(1) Easy
1007 Minimum Domino Rotations For Equal Row C++ Python O(n) O(1) Medium
1010 Pairs of Songs With Total Durations Divisible by 60 C++ Python O(n) O(1) Easy
1013 Partition Array Into Three Parts With Equal Sum C++ Python O(n) O(1) Easy
1014 Best Sightseeing Pair C++ Python O(n) O(1) Medium
1018 Binary Prefix Divisible By 5 C++ Python O(n) O(1) Easy
1030 Matrix Cells in Distance Order C++ Python O(m * n) O(1) Easy
1031 Maximum Sum of Two Non-Overlapping Subarrays C++ Python O(n) O(1) Medium
1051 Height Checker C++ Python O(nlogn) O(n) Easy
1052 Grumpy Bookstore Owner C++ Python O(n) O(1) Medium
1072 Flip Columns For Maximum Number of Equal Rows C++ Python O(m * n) O(m * n) Medium
1074 Number of Submatrices That Sum to Target C++ Python O(m^2 * n) O(n) Hard
1085 Sum of Digits in the Minimum Number C++ Python O(n * l) O(l) Easy 🔒
1089 Duplicate Zeros C++ Python O(n) O(1) Easy
1093 Statistics from a Large Sample C++ Python O(n) O(1) Medium
1099 Two Sum Less Than K C++ Python O(nlogn) O(1) Easy 🔒
1109 Corporate Flight Bookings C++ Python O(n) O(1) Medium Line Sweep
1144 Decrease Elements To Make Array Zigzag C++ Python O(n) O(1) Medium
1184 Distance Between Bus Stops C++ Python O(n) O(1) Easy
1200 Minimum Absolute Difference C++ Python O(nlogn) O(n) Easy
1222 Queens That Can Attack the King C++ Python O(1) O(1) Medium
1252 Cells with Odd Values in a Matrix C++ Python O(n + m) O(n + m) Easy
1260 Shift 2D Grid C++ Python O(n) O(1) Easy
1267 Count Servers that Communicate C++ Python O(m * n) O(m + n) Medium
1275 Find Winner on a Tic Tac Toe Game C++ Python O(1) O(1) Easy
1295 Find Numbers with Even Number of Digits C++ Python O(nlog(logm)) O(logm) Easy
1299 Replace Elements with Greatest Element on Right Side C++ Python O(n) O(1) Easy
1304 Find N Unique Integers Sum up to Zero C++ Python O(n) O(1) Easy
1313 Decompress Run-Length Encoded List C++ Python O(n) O(1) Easy
1329 Sort the Matrix Diagonally C++ Python O(m * n * log(min(m, n)) O(m * n) Medium Sort
1331 Rank Transform of an Array C++ Python O(nlogn) O(n) Easy
1333 Filter Restaurants by Vegan-Friendly, Price and Distance C++ Python O(rlogr) O(r) Medium Sort
1337 The K Weakest Rows in a Matrix C++ Python O(m * n) O(k) Easy OrderedDict, Quick Select
1343 Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold C++ Python O(n) O(1) Medium
1346 Check If N and Its Double Exist C++ Python O(n) O(n) Easy
1351 Count Negative Numbers in a Sorted Matrix C++ Python O(m + n) O(1) Easy
1375 Bulb Switcher III C++ Python O(n) O(1) Medium
1380 Lucky Numbers in a Matrix C++ Python O(m * n) O(m + n) Easy
1389 Create Target Array in the Given Order C++ Python O(n^2) O(1) Easy
1394 Find Lucky Integer in an Array C++ Python O(n) O(n) Easy
1399 Count Largest Group C++ Python O(nlogn) O(n) Easy
1404 Number of Steps to Reduce a Number in Binary Representation to One C++ Python O(n) O(1) Medium
1413 Minimum Value to Get Positive Step by Step Sum C++ Python O(n) O(1) Easy
1426 Counting Elements C++ Python O(n) O(n) Easy 🔒
1427 Perform String Shifts C++ Python O(n + l) O(1) Easy 🔒
1428 Leftmost Column with at Least a One C++ Python O(m + n) O(1) Medium 🔒
1431 Kids With the Greatest Number of Candies C++ Python O(n) O(1) Easy
1437 Check If All 1's Are at Least Length K Places Away C++ Python O(n) O(1) Medium
1450 Number of Students Doing Homework at a Given Time C++ Python O(n) O(1) Easy
1460 Make Two Arrays Equal by Reversing Sub-arrays C++ Python O(n) O(n) Easy
1464 Maximum Product of Two Elements in an Array C++ Python O(n) O(1) Easy
1465 Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts C++ Python O(hlogh + wlogw) O(1) Medium
1470 Shuffle the Array C++ Python O(n) O(1) Easy Inplace
1471 The k Strongest Values in an Array C++ Python O(n) O(1) Medium Quick Select
1475 Final Prices With a Special Discount in a Shop C++ Python O(n) O(n) Easy Mono Stack
1480 Running Sum of 1d Array C++ Python O(n) O(1) Easy
1491 Average Salary Excluding the Minimum and Maximum Salary C++ Python O(n) O(1) Easy
1502 Can Make Arithmetic Progression From Sequence C++ Python O(n) O(1) Easy
1503 Last Moment Before All Ants Fall Out of a Plank C++ Python O(n) O(1) Medium
1534 Count Good Triplets C++ Python O(n^3) O(1) Easy
1535 Find the Winner of an Array Game C++ Python O(n) O(1) Medium
1538 Guess the Majority in a Hidden Array C++ Python O(n) O(1) Medium 🔒
1550 Three Consecutive Odds C++ Python O(n) O(1) Easy
1559 Detect Cycles in 2D Grid C++ Python O(m * n) O(m * n) Hard Union Find, BFS
1560 Most Visited Sector in a Circular Track C++ Python O(n) O(1) Easy
1562 Find Latest Group of Size M C++ Python O(n) O(n) Medium
1566 Detect Pattern of Length M Repeated K or More Times C++ Python O(n) O(1) Easy
1572 Matrix Diagonal Sum C++ Python O(n) O(1) Easy
1574 Shortest Subarray to be Removed to Make Array Sorted C++ Python O(n) O(1) Medium
1582 Special Positions in a Binary Matrix C++ Python O(n^2) O(n) Easy
1583 Count Unhappy Friends C++ Python O(n^2) O(n^2) Medium
1619 Mean of Array After Removing Some Elements C++ Python O(n) O(1) Easy Quick Select
1629 Slowest Key C++ Python O(n) O(1) Easy
1646 Get Maximum in Generated Array C++ Python O(n) O(n) Easy
1652 Defuse the Bomb C++ Python O(n) O(1) Easy
1672 Richest Customer Wealth C++ Python O(m * n) O(1) Easy
1700 Number of Students Unable to Eat Lunch C++ Python O(n) O(1) Easy
1701 Average Waiting Time C++ Python O(n) O(1) Medium
1706 Where Will the Ball Fall C++ Python O(m * n) O(1) Medium
1714 Sum Of Special Evenly-Spaced Elements In Array C++ Python O(n * sqrt(n)) O(n * sqrt(n)) Hard 🔒
1726 Tuple with Same Product C++ Python O(n^2) O(n^2) Medium
1732 Find the Highest Altitude C++ Python O(n) O(1) Medium
1738 Find Kth Largest XOR Coordinate Value C++ Python O(m * n) on average O(m * n) Medium Quick Select
1742 Maximum Number of Balls in a Box C++ Python O(nlogm) O(logm) Easy
1752 Check if Array Is Sorted and Rotated C++ Python O(n) O(1) Easy
1755 Closest Subsequence Sum C++ Python O(n * 2^(n/2)) O(2^(n/2)) Hard Meet in the Middle
1773 Count Items Matching a Rule C++ Python O(n) O(1) Easy
1779 Find Nearest Point That Has the Same X or Y Coordinate C++ Python O(n) O(1) Easy
1800 Maximum Ascending Subarray Sum C++ Python O(n) O(1) Easy
1826 Faulty Sensor C++ Python O(n) O(1) Easy 🔒
1848 Minimum Distance to the Target Element C++ Python O(n) O(1) Easy
1861 Rotating the Box C++ Python O(m * n) O(1) Medium
1869 Longer Contiguous Segments of Ones than Zeros C++ Python O(n) O(1) Easy
1878 Get Biggest Three Rhombus Sums in a Grid C++ Python O(m * n * min(m, n)) O(m * n) Easy
1886 Determine Whether Matrix Can Be Obtained By Rotation C++ Python O(m * n) O(1) Easy
1895 Largest Magic Square C++ Python O(max(m, n) * min(m, n)^3) O(m * n) Medium
1906 Minimum Absolute Difference Queries C++ Python O(r * (n + q)) O(r * n) Medium Prefix Sum, Binary Search
1909 Remove One Element to Make the Array Strictly Increasing C++ Python O(n) O(1) Easy
1914 Cyclically Rotating a Grid C++ Python O(m * n) O(1) Medium Inplace
1920 Build Array from Permutation C++ Python O(n) O(1) Easy Inplace
1929 Concatenation of Array C++ Python O(n) O(1) Easy
1940 Longest Common Subsequence Between Sorted Arrays C++ Python O(m * n) O(l) Medium 🔒
1958 Check if Move is Legal C++ Python O(1) O(1) Medium
1966 Binary Searchable Numbers in an Unsorted Array C++ Python O(n) O(n) Medium 🔒 Prefix Sum
1970 Last Day Where You Can Still Cross C++ Python O(m * n) O(m * n) Hard variant of Bricks Falling When Hit Union Find
1983 Widest Pair of Indices With Equal Range Sum C++ Python O(n) O(n) Medium variant of Find the Longest Substring Containing Vowels in Even Counts, 🔒 Prefix Sum
1991 Find the Middle Index in Array C++ Python O(n) O(1) Easy Prefix Sum
1992 Find All Groups of Farmland C++ Python O(m * n) O(1) Medium variant of Number of Islands
1998 GCD Sort of an Array C++ Python O(nlogn + m) O(n + m) Hard Union Find, Sieve of Eratosthenes
2007 Find Original Array From Doubled Array C++ Python O(n + klogk) O(k) Medium variant of Array of Doubled Pairs
2011 Final Value of Variable After Performing Operations C++ Python O(n) O(1) Easy
2012 Sum of Beauty in the Array C++ Python O(n) O(n) Medium Prefix Sum
2016 Maximum Difference Between Increasing Elements C++ Python O(n) O(1) Easy variant of Best Time to Buy and Sell Stock
2017 Grid Game C++ Python O(n) O(1) Medium Prefix Sum
2018 Check if Word Can Be Placed In Crossword C++ Python O(m * n) O(1) Medium
2022 Convert 1D Array Into 2D Array C++ Python O(m * n) O(1) Easy
2033 Minimum Operations to Make a Uni-Value Grid C++ Python O(m * n) on average O(m * n) Medium variant of Minimum Moves to Equal Array Elements II Math, Median, Quick Select
2035 Partition Array Into Two Arrays to Minimize Sum Difference C++ Python O(n * 2^n) O(2^n) Hard Meet in the Middle
2038 Remove Colored Pieces if Both Neighbors are the Same Color C++ Python O(n) O(1) Medium
2055 Plates Between Candles C++ Python O(n + q) O(n) Medium Prefix Sum
2057 Smallest Index With Equal Value C++ Python O(n) O(1) Easy
2075 Decode the Slanted Ciphertext C++ Python O(n) O(1) Medium
2078 Two Furthest Houses With Different Colors C++ Python O(n) O(1) Easy
2079 Watering Plants C++ Python O(n) O(1) Medium
2098 Subsequence of Size K With the Largest Even Sum C++ Python O(n) on average O(1) Medium 🔒 Quick Select
2099 Find Subsequence of Length K With the Largest Sum C++ Python O(n) on average O(n) Easy Quick Select
2100 Find Good Days to Rob the Bank C++ Python O(n) O(n) Medium Prefix Sum
2106 Maximum Fruits Harvested After at Most K Steps C++ Python O(n) O(n) Hard Prefix Sum
2113 Elements in Array After Removing and Replacing Elements C++ Python O(n) O(1) Medium 🔒
2121 Intervals Between Identical Elements C++ Python O(n) O(n) Medium Prefix Sum
2122 Recover the Original Array C++ Python O(n^2) O(n) Hard
2128 Remove All Ones With Row and Column Flips C++ Python O(m * n) O(1) Medium 🔒
2132 Stamping the Grid C++ Python O(m * n) O(m * n) Hard Prefix Sum
2155 All Divisions With the Highest Score of a Binary Array C++ Python O(n) O(1) Medium Prefix Sum
2194 Cells in a Range on an Excel Sheet C++ Python O(26^2) O(1) Easy
2202 Maximize the Topmost Element After K Moves C++ Python O(min(n, k)) O(1) Medium Constructive Algorithms
2210 Count Hills and Valleys in an Array C++ Python O(n) O(1) Easy Simulation
2219 Maximum Sum Score of Array C++ Python O(n) O(1) Medium 🔒 Prefix Sum
2237 Count Positions on Street With Required Brightness C++ Python O(n + l) O(min(n, l)) Medium 🔒 Line Sweep
2239 Find Closest Number to Zero C++ Python O(n) O(1) Easy Array
2245 Maximum Trailing Zeros in a Cornered Path C++ Python O(m * n) O(m * n) Medium Prefix Sum


String

# Title Solution Time Space Difficulty Tag Note
1016 Binary String With Substrings Representing 1 To N C++ Python O(n^2) O(1) Medium
1023 Camelcase Matching C++ Python O(n * l) O(1) Medium
1061 Lexicographically Smallest Equivalent String C++ Python O(n) O(n) Medium 🔒 Union Find
1056 Confusing Number C++ Python O(logn) O(logn) Easy 🔒
1071 Greatest Common Divisor of Strings C++ Python O(m + n) O(1) Easy
1078 Occurrences After Bigram C++ Python O(n) O(1) Easy
1100 Find K-Length Substrings With No Repeated Characters C++ Python O(n) O(k) Medium 🔒
1108 Defanging an IP Address C++ Python O(n) O(1) Easy
1119 Remove Vowels from a String C++ Python O(n) O(1) Easy 🔒
1147 Longest Chunked Palindrome Decomposition C++ Python O(n) O(1) Hard Rabin-Karp Algorithm
1177 Can Make Palindrome from Substring C++ Python O(m + n) O(n) Medium
1178 Number of Valid Words for Each Puzzle C++ Python O(n * l + m * L) O(L!) Hard Trie, Bit Manipulation
1189 Maximum Number of Balloons C++ Python O(n) O(1) Easy Hash
1233 Remove Sub-Folders from the Filesystem C++ Python O(n) O(t) Medium Trie
1271 Hexspeak C++ Python O(n) O(1) Easy
1309 Decrypt String from Alphabet to Integer Mapping C++ Python O(n) O(1) Easy
1324 Print Words Vertically C++ Python O(n) O(n) Medium
1328 Break a Palindrome C++ Python O(n) O(1) Medium
1332 Remove Palindromic Subsequences C++ Python O(n) O(1) Easy
1347 Minimum Number of Steps to Make Two Strings Anagram C++ Python O(n) O(1) Medium
1370 Increasing Decreasing String C++ Python O(n) O(1) Easy Sort
1371 Find the Longest Substring Containing Vowels in Even Counts C++ Python O(n) O(1) Medium
1374 Generate a String With Characters That Have Odd Count C++ Python O(n) O(1) Easy
1392 Longest Happy Prefix C++ Python O(n) O(n) Hard KMP Algorithm, Rabin-Karp Algorithm
1408 String Matching in an Array C++ Python O(n) O(t) Easy KMP Algorithm, Aho-Corasick Automata, Trie
1410 HTML Entity Parser C++ Python O(n) O(t) Medium Aho-Corasick Automata, Trie
1417 Reformat The String C++ Python O(n) O(1) Easy
1422 Maximum Score After Splitting a String C++ Python O(n) O(1) Easy
1432 Max Difference You Can Get From Changing an Integer C++ Python O(logn) O(logn) Medium
1436 Destination City C++ Python O(n) O(n) Easy
1446 Consecutive Characters C++ Python O(n) O(1) Easy
1455 Check If a Word Occurs As a Prefix of Any Word in a Sentence C++ Python O(n) O(n) Easy KMP Algorithm
1461 Check If a String Contains All Binary Codes of Size K C++ Python O(n * k) O(k * 2^k) Medium Bit Manipulation
1496 Path Crossing C++ Python O(n) O(n) Easy
1507 Reformat Date C++ Python O(n) O(1) Easy
1528 Shuffle String C++ Python O(n) O(1) Easy
1529 Bulb Switcher IV C++ Python O(n) O(1) Medium
1540 Can Convert String in K Moves C++ Python O(n) O(1) Medium
1542 Find Longest Awesome Substring C++ Python O(n) O(1) Hard
1544 Make The String Great C++ Python O(n) O(1) Easy
1545 Find Kth Bit in Nth Binary String C++ Python O(n) O(1) Medium
1554 Strings Differ by One Character C++ Python O(n * m) O(n) Medium Rabin-Karp Algorithm
1556 Thousand Separator C++ Python O(n) O(1) Easy
1573 Number of Ways to Split a String C++ Python O(n) O(1) Medium
1576 Replace All ?'s to Avoid Consecutive Repeating Characters C++ Python O(n) O(1) Easy
1592 Rearrange Spaces Between Words C++ Python O(n) O(1) Easy Inplace
1598 Crawler Log Folder C++ Python O(n) O(1) Easy
1614 Maximum Nesting Depth of the Parentheses C++ Python O(n) O(1) Easy
1624 Largest Substring Between Two Equal Characters C++ Python O(n) O(1) Easy
1638 Count Substrings That Differ by One Character C++ Python O(m * n) O(1) Medium variant of Count Unique Characters of All Substrings of a Given String Tricky
1662 Check If Two String Arrays are Equivalent C++ Python O(n) O(1) Easy
1668 Maximum Repeating Substring C++ Python O(n) O(m) Easy KMP Algorithm
1678 Goal Parser Interpretation C++ Python O(n) O(1) Easy
1684 Count the Number of Consistent Strings C++ Python O(n) O(1) Easy
1694 Reformat Phone Number C++ Python O(n) O(1) Easy Inplace
1698 Number of Distinct Substrings in a String C++ Python O(n^2) O(t) Medium 🔒 Trie
1704 Determine if String Halves Are Alike C++ Python O(n) O(1) Easy
1763 Longest Nice Substring C++ Python O(n) O(n) Easy
1768 Merge Strings Alternately C++ Python O(m + n) O(1) Easy
1784 Check if Binary String Has at Most One Segment of Ones C++ Python O(n) O(1) Easy
1790 Check if One String Swap Can Make Strings Equal C++ Python O(n) O(1) Easy
1796 Second Largest Digit in a String C++ Python O(n) O(1) Easy
1805 Number of Different Integers in a String C++ Python O(n) O(n) Easy
1813 Sentence Similarity III C++ Python O(n) O(1) Medium
1816 Truncate Sentence C++ Python O(n) O(1) Easy
1832 Check if the Sentence Is Pangram C++ Python O(n) O(1) Easy
1839 Longest Substring Of All Vowels in Order C++ Python O(n) O(1) Medium
1844 Replace All Digits with Characters C++ Python O(n) O(1) Easy
1854 Maximum Population Year C++ Python O(n) O(1) Easy Line Sweep
1858 Longest Word With All Prefixes C++ Python O(n) O(t) Medium 🔒 Trie, DFS
1876 Substrings of Size Three with Distinct Characters C++ Python O(n) O(1) Easy
1880 Check if Word Equals Summation of Two Words C++ Python O(n) O(1) Easy
1903 Largest Odd Number in String C++ Python O(n) O(1) Easy
1910 Remove All Occurrences of a Substring C++ Python O(n + m) O(n + m) Medium KMP Algorithm
1933 Check if String Is Decomposable Into Value-Equal Substrings C++ Python O(n) O(1) Easy 🔒
1935 Maximum Number of Words You Can Type C++ Python O(n) O(1) Easy
1957 Delete Characters to Make Fancy String C++ Python O(n) O(1) Easy Inplace
1961 Check If String Is a Prefix of Array C++ Python O(n) O(1) Easy
1963 Minimum Number of Swaps to Make the String Balanced C++ Python O(n) O(1) Medium variant of Maximum Nesting Depth of the Parentheses
1967 Number of Strings That Appear as Substrings in Word C++ Python O(n * l + m) O(t) Easy KMP Algorithm, Aho-Corasick Automata, Trie
1974 Minimum Time to Type Word Using Special Typewriter C++ Python O(n) O(1) Easy
2000 Reverse Prefix of Word C++ Python O(n) O(1) Easy
2042 Check if Numbers Are Ascending in a Sentence C++ Python O(n) O(1) Easy
2047 Number of Valid Words in a Sentence C++ Python O(n) O(1) Easy
2048 Next Greater Numerically Balanced Number C++ Python O(1) O(1) Medium Permutations, Precompute, Binary Search
2081 Sum of k-Mirror Numbers C++ Python O(10^6) O(1) Hard String, Palindrome, Brute Force
2103 Rings and Rods C++ Python O(n) O(1) Easy
2108 Find First Palindromic String in the Array C++ Python O(n) O(1) Easy
2109 Adding Spaces to a String C++ Python O(n) O(1) Medium Inplace
2114 Maximum Number of Words Found in Sentences C++ Python O(n) O(1) Easy
2116 Check if a Parentheses String Can Be Valid C++ Python O(n) O(1) Medium
2124 Check if All A's Appears Before All B's C++ Python O(n) O(1) Easy
2129 Capitalize the Title C++ Python O(n) O(1) Easy
2131 Longest Palindrome by Concatenating Two Letter Words C++ Python O(n) O(n) Medium
2135 Count Words Obtained After Adding a Letter C++ Python O(n) O(n) Medium Bitmasks
2138 Divide a String Into Groups of Size k C++ Python O(n) O(1) Easy
2156 Find Substring With Given Hash Value C++ Python O(n) O(1) Medium Rabin-Karp Algorithm, Rolling Hash
2157 Groups of Strings C++ Python O(26 * n) O(26 * n) Hard Bitmasks, Union Find
2168 Unique Substrings With Equal Digit Frequency C++ Python O(n^2) O(n^2) Medium 🔒 Rabin-Karp Algorithm, Rolling Hash
2185 Counting Words With a Given Prefix C++ Python O(n * p) O(1) Easy
2186 Minimum Number of Steps to Make Two Strings Anagram II C++ Python O(n) O(1) Medium variant of Minimum Number of Steps to Make Two Strings Anagram
2211 Count Collisions on a Road C++ Python O(n) O(1) Medium Counting, Simulation
2213 Longest Substring of One Repeating Character C++ Python O(nlogn) O(n) Hard Segment Tree
2223 Sum of Scores of Built Strings C++ Python O(n) O(n) Hard Z-Function
2232 Minimize Result by Adding Parentheses to Expression C++ Python O(n^2) O(1) Medium Brute Force
2243 Calculate Digit Sum of a String C++ Python O(n) O(n) Easy Simulation


Linked List

# Title Solution Time Space Difficulty Tag Note
1171 Remove Zero Sum Consecutive Nodes from Linked List C++ Python O(n) O(n) Medium OrderedDict, Hash
1180 Count Substrings with Only One Distinct Letter C++ Python O(n) O(1) Easy 🔒
1181 Before and After Puzzle C++ Python O(l * rlogr) O(l * (n + r)) Medium 🔒 Hash
1265 Print Immutable Linked List in Reverse C++ Python O(n) O(sqrt(n)) Medium 🔒
1290 Convert Binary Number in a Linked List to Integer C++ Python O(n) O(1) Easy
1474 Delete N Nodes After M Nodes of a Linked List C++ Python O(n) O(1) Easy 🔒
1634 Add Two Polynomials Represented as Linked Lists C++ Python O(m + n) O(1) Medium 🔒
1650 Lowest Common Ancestor of a Binary Tree III C++ Python O(h) O(1) Medium 🔒, variant of Intersection of Two Linked Lists
1669 Merge In Between Linked Lists C++ Python O(m + n) O(1) Medium
1721 Swapping Nodes in a Linked List C++ Python O(n) O(1) Medium
1836 Remove Duplicates From an Unsorted Linked List C++ Python O(n) O(n) Medium 🔒
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


Stack

# Title Solution Time Space Difficulty Tag Note
1003 Check If Word Is Valid After Substitutions C++ Python O(n) O(n) Medium
1019 Next Greater Node In Linked List C++ Python O(n) O(n) Medium Mono Stack
1021 Remove Outermost Parentheses C++ Python O(n) O(1) Easy
1047 Remove All Adjacent Duplicates In String C++ Python O(n) O(n) Easy
1063 Number of Valid Subarrays C++ Python O(n) O(n) Hard 🔒 Mono Stack
1130 Minimum Cost Tree From Leaf Values C++ Python O(n) O(n) Medium Mono Stack
1190 Reverse Substrings Between Each Pair of Parentheses C++ Python O(n) O(n) Medium
1209 Remove All Adjacent Duplicates in String II C++ Python O(n) O(n) Medium
1441 Build an Array With Stack Operations C++ Python O(n) O(1) Easy
1541 Minimum Insertions to Balance a Parentheses String C++ Python O(n) O(1) Medium
1597 Build Binary Expression Tree From Infix Expression C++ Python O(n) O(n) Medium 🔒, variant of Basic Calculator III
1856 Maximum Subarray Min-Product C++ Python O(n) O(n) Medium variant of Largest Rectangle in Histogram Mono Stack, Prefix Sum
1944 Number of Visible People in a Queue C++ Python O(n) O(n) Hard variant of Buildings With an Ocean View Mono Stack
1950 Maximum of Minimum Values in All Subarrays C++ Python O(n) O(n) Medium 🔒 Mono Stack
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


Queue

# Title Solution Time Space Difficulty Tag Note
1424 Diagonal Traverse II C++ Python O(m * n) O(m) Medium
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


Binary Heap

# Title Solution Time Space Difficulty Tag Note
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 Sorted List
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
1962 Remove Stones to Minimize the Total C++ Python O(klogn) O(1) Medium
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


Tree

# Title Solution Time Space Difficulty Tag Note
1008 Construct Binary Search Tree from Preorder Traversal C++ Python O(n) O(h) Medium
1022 Sum of Root To Leaf Binary Numbers C++ Python O(n) O(h) Easy
1026 Maximum Difference Between Node and Ancestor C++ Python O(n) O(h) Medium DFS
1028 Recover a Tree From Preorder Traversal C++ Python O(n) O(h) Hard DFS
1032 Stream of Characters C++ C++ Python Python ctor: O(n)
query: O(m)
O(t) Hard Aho-Corasick Automata, Trie
1038 Binary Search Tree to Greater Sum Tree C++ Python O(n) O(h) Medium DFS
1065 Index Pairs of a String C++ Python O(n + m + z) O(t) Easy 🔒 Aho-Corasick Automata, Trie
1080 Insufficient Nodes in Root to Leaf Paths C++ Python O(n) O(h) Medium DFS
1104 Path In Zigzag Labelled Binary Tree C++ Python O(logn) O(logn) Easy Math
1120 Maximum Average Subtree C++ Python O(n) O(h) Easy 🔒 DFS
1123 Lowest Common Ancestor of Deepest Leaves C++ Python O(n) O(h) Medium DFS
1145 Binary Tree Coloring Game C++ Python O(n) O(h) Medium DFS
1257 Smallest Common Region C++ Python O(m * n) O(n) Medium
1261 Find Elements in a Contaminated Binary Tree C++ Python O(n) O(h) Medium DFS
1325 Delete Leaves With a Given Value C++ Python O(n) O(h) Medium DFS
1339 Maximum Product of Splitted Binary Tree C++ Python O(n) O(h) Medium DFS
1409 Queries on a Permutation With Key C++ Python O(nlogn) O(n) Medium BIT, Fenwick Tree
1430 Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary Tree C++ Python O(n) O(h) Medium 🔒 BFS, DFS, Stack
1443 Minimum Time to Collect All Apples in a Tree C++ Python O(n) O(n) Medium DFS, Stack
1448 Count Good Nodes in Binary Tree C++ Python O(n) O(h) Medium DFS, Stack
1457 Pseudo-Palindromic Paths in a Binary Tree C++ Python O(n) O(h) Medium DFS, Stack
1469 Find All The Lonely Nodes C++ Python O(n) O(h) Easy 🔒 DFS, Stack
1490 Clone N-ary Tree C++ Python O(n) O(h) Medium 🔒 DFS, Stack
1505 Minimum Possible Integer After at Most K Adjacent Swaps On Digits C++ Python O(nlogn) O(n) Hard BIT, Fenwick Tree
1506 Find Root of N-Ary Tree C++ Python O(n) O(1) Medium 🔒 Bit Manipulation
1516 Move Sub-Tree of N-Ary Tree C++ Python O(n) O(h) Hard 🔒 DFS, Stack
1519 Number of Nodes in the Sub-Tree With the Same Label C++ Python O(n) O(h) Medium DFS, Stack
1522 Diameter of N-Ary Tree C++ Python O(n) O(h) Medium 🔒 DFS, Stack
1530 Number of Good Leaf Nodes Pairs C++ Python O(n) O(h) Medium DFS, Stack
1612 Check If Two Expression Trees are Equivalent C++ Python O(n) O(1) Medium 🔒 Morris Traversal, Inorder Traversal, Stack, Hash Table
1649 Create Sorted Array through Instructions C++ Python O(nlogn) O(n) Hard variant of Count of Smaller Numbers After Self BIT, Fenwick Tree, Merge Sort
1666 Change the Root of a Binary Tree C++ Python O(h) O(1) Medium 🔒
1834 Single-Threaded CPU C++ Python O(nlogn) O(n) Medium
1938 Maximum Genetic Difference Query C++ Python O(nlogk + mlogk) O(n + logk) Hard variant of Maximum XOR With an Element From Array DFS, Greedy, Trie
1948 Delete Duplicate Folders in System C++ Python O(n * m * l + tlogt + l * t) O(l * t) Hard variant of Find Duplicate Subtrees Trie, DFS, Hash
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


Hash Table

# Title Solution Time Space Difficulty Tag Note
1001 Grid Illumination C++ Python O(l + q) O(l) Hard
1124 Longest Well-Performing Interval C++ Python O(n) O(n) Medium
1133 Largest Unique Number C++ Python O(n) O(n) Easy 🔒 Hash
1152 Analyze User Website Visit Pattern C++ Python O(n^3) O(n^3) Medium 🔒 Hash
1153 String Transforms Into Another String C++ Python O(n) O(1) Hard 🔒 Hash
1160 Find Words That Can Be Formed by Characters C++ Python O(m * n) O(1) Easy
1165 Single-Row Keyboard C++ Python O(n) O(1) Easy 🔒
1198 Find Smallest Common Element in All Rows C++ Python O(m * n) O(n) Medium 🔒
1207 Unique Number of Occurrences C++ Python O(n) O(n) Easy
1224 Maximum Equal Frequency C++ Python O(n) O(n) Hard
1418 Display Table of Food Orders in a Restaurant C++ Python O(n + tlogt + flogf) O(n) Medium
1452 People Whose List of Favorite Companies Is Not a Subset of Another List C++ Python O(n * m * l + n^2 * m) O(n * m * l) Medium
1487 Making File Names Unique C++ Python O(n) O(n) Medium
1577 Number of Ways Where Square of Number Is Equal to Product of Two Numbers C++ Python O(m * n) O(m + n) Medium
1590 Make Sum Divisible by P C++ Python O(n) O(p) Medium variant of Subarray Sums Divisible by K
1640 Check Array Formation Through Concatenation C++ Python O(n) O(n) Easy
1657 Determine if Two Strings Are Close C++ Python O(n) O(1) Medium
1679 Max Number of K-Sum Pairs C++ Python O(n) O(n) Medium
1711 Count Good Meals C++ Python O(n) O(1) Medium
1748 Sum of Unique Elements C++ Python O(n) O(n) Easy
1781 Sum of Beauty of All Substrings C++ Python O(n^2) O(1) Medium
1807 Evaluate the Bracket Pairs of a String C++ Python O(n + m) O(n + m) Medium
1814 Count Nice Pairs in an Array C++ Python O(nlogm) O(n) Medium
1817 Finding the Users Active Minutes C++ Python O(n) O(n) Medium
1915 Number of Wonderful Substrings C++ Python O(n) O(1) Medium
1923 Longest Common Subpath C++ Python O(m * nlogn) O(n) Hard Binary Search, Rabin-Karp Algorithm
1925 Count Square Sum Triples C++ Python O(n^2) O(n) Easy
1930 Unique Length-3 Palindromic Subsequences C++ Python O(n) O(1) Medium
1941 Check if All Characters Have Equal Number of Occurrences C++ Python O(n) O(1) Easy
1995 Count Special Quadruplets C++ Python O(n^3) O(n) Easy variant of 4 Sum
2006 Count Number of Pairs With Absolute Difference K C++ Python O(n) O(n) Easy variant of Two Sum
2023 Number of Pairs of Strings With Concatenation Equal to Target C++ Python O(n * l) O(n) Medium variant of Two Sum
2025 Maximum Number of Ways to Partition an Array C++ Python O(n) O(n) Hard Prefix Sum
2032 Two Out of Three C++ Python O(n) O(min(n, r)) Easy Counting
2053 Kth Distinct String in an Array C++ Python O(n) O(n) Easy
2068 Check Whether Two Strings are Almost Equivalent C++ Python O(n) O(1) Easy
2085 Count Common Words With One Occurrence C++ Python O(m + n) O(m + n) Easy
2120 Execution of All Suffix Instructions Staying in a Grid C++ Python O(m) O(m) Medium
2150 Find All Lonely Numbers in the Array C++ Python O(n) O(n) Medium
2154 Keep Multiplying Found Values by Two C++ Python O(n) O(n) Easy
2170 Minimum Operations to Make the Array Alternating C++ Python O(n) O(n) Medium Freq Table
2190 Most Frequent Number Following Key In an Array C++ Python O(n) O(n) Easy Freq Table
2201 Count Artifacts That Can Be Extracted C++ Python O(a + d) O(d) Medium Hash Table
2206 Divide Array Into Equal Pairs C++ Python O(n) O(n) Easy Hash Table
2215 Find the Difference of Two Arrays C++ Python O(n) O(n) Easy Hash Table
2225 Find Players With Zero or One Losses C++ Python O(nlogn) O(n) Medium Hash Table, Sort
2229 Check if an Array Is Consecutive C++ Python O(n) O(n) Easy 🔒 Hash Table, Sort


Math

# Title Solution Time Space Difficulty Tag Note
1006 Clumsy Factorial C++ Python O(1) O(1) Medium
1009 Complement of Base 10 Integer C++ Python O(logn) O(1) Easy
1012 Numbers With Repeated Digits C++ Python O(logn) O(logn) Hard
1015 Smallest Integer Divisible by K C++ Python O(k) O(1) Medium
1017 Convert to Base -2 C++ Python O(logn) O(1) Medium
1025 Divisor Game C++ Python O(1) O(1) Easy DP
1037 Valid Boomerang C++ Python O(1) O(1) Easy
1041 Robot Bounded In Circle C++ Python O(n) O(1) Medium
1067 Digit Count in Range C++ Python O(logn) O(1) Hard 🔒, variant of Number of Digit One
1073 Adding Two Negabinary Numbers C++ Python O(n) O(n) Medium
1079 Letter Tile Possibilities C++ Python O(n^2) O(n) Medium Generating Function, Backtracking
1088 Confusing Number II C++ Python O(logn) O(logn) Hard 🔒
1103 Distribute Candies to People C++ Python O(n + logc) O(1) Easy Binary Search
1118 Number of Days in a Month C++ Python O(1) O(1) Easy 🔒
1121 Divide Array Into Increasing Sequences C++ Python O(n) O(1) Hard 🔒
1128 Number of Equivalent Domino Pairs C++ Python O(n) O(n) Easy
1131 Maximum of Absolute Value Expression C++ Python O(n) O(1) Medium
1134 Armstrong Number C++ Python O(klogk) O(k) Easy 🔒
1150 Check If a Number Is Majority Element in a Sorted Array C++ Python O(nlogn) O(1) Easy 🔒 Binary Search
1157 Online Majority Element In Subarray C++ Python ctor: O(n)
query: O(klogn)
O(n) Hard Binary Search, Segment Tree, Boyer–Moore Majority Vote Algorithm
1154 Day of the Year C++ Python O(1) O(1) Easy
1175 Prime Arrangements C++ Python O(nlog(logn)) O(n) Easy Sieve of Eratosthenes
1185 Day of the Week C++ Python O(1) O(1) Easy Zeller Formula
1197 Minimum Knight Moves C++ Python O(1) O(1) Medium 🔒 DP, Math
1217 Play with Chips C++ Python O(n) O(1) Medium
1227 Airplane Seat Assignment Probability C++ Python O(1) O(1) Medium
1232 Check If It Is a Straight Line C++ Python O(1) O(1) Easy
1237 Find Positive Integer Solution for a Given Equation C++ Python O(n) O(1) Easy
1238 Circular Permutation in Binary Representation C++ Python O(2^n) O(1) Medium variant of Gray Code
1250 Check If It Is a Good Array C++ Python O(n) O(1) Hard Bézout's identity
1256 Encode Number C++ Python O(logn) O(1) Medium
1259 Handshakes That Don't Cross C++ Python O(n) O(1) Hard Catalan Number, DP
1266 Minimum Time Visiting All Points C++ Python O(n) O(1) Easy
1276 Number of Burgers with No Waste of Ingredients C++ Python O(1) O(1) Medium
1281 Subtract the Product and Sum of Digits of an Integer C++ Python O(logn) O(1) Easy
1300 Sum of Mutated Array Closest to Target C++ Python O(nlogn) O(1) Medium Binary Search
1317 Convert Integer to the Sum of Two No-Zero Integers C++ Python O(logn) O(1) Easy
1323 Maximum 69 Number C++ Python O(logn) O(1) Easy
1330 Reverse Subarray To Maximize Array Value C++ Python O(n) O(1) Hard
1344 Angle Between Hands of a Clock C++ Python O(1) O(1) Medium
1359 Count All Valid Pickup and Delivery Options C++ Python O(n) O(1) Hard
1360 Number of Days Between Two Dates C++ Python O(1) O(1) Easy variant of Day of the Year
1362 Closest Divisors C++ Python O(sqrt(n)) O(1) Medium
1363 Largest Multiple of Three C++ Python O(n) O(1) Hard
1390 Four Divisors C++ Python O(n * sqrt(n)) O(1) Medium
1401 Circle and Rectangle Overlapping C++ Python O(1) O(1) Medium
1415 The k-th Lexicographical String of All Happy Strings of Length n C++ Python O(n) O(1) Medium
1442 Count Triplets That Can Form Two Arrays of Equal XOR C++ Python O(n) O(n) Medium
1447 Simplified Fractions C++ Python O(n^2 * logn) O(n^2) Medium
1486 XOR Operation in an Array C++ Python O(1) O(1) Easy
1492 The kth Factor of n C++ Python O(sqrt(n)) O(1) Medium
1497 Check If Array Pairs Are Divisible by k C++ Python O(n) O(k) Medium
1512 Number of Good Pairs C++ Python O(n) O(1) Easy
1513 Number of Substrings With Only 1s C++ Python O(n) O(1) Medium
1525 Number of Good Ways to Split a String C++ Python O(n) O(1) Medium
1537 Get the Maximum Score C++ Python O(m + n) O(1) Hard
1551 Minimum Operations to Make Array Equal C++ Python O(1) O(1) Medium
1611 Minimum One Bit Operations to Make Integers Zero C++ Python O(logn) O(1) Hard variant of Gray Code
1641 Count Sorted Vowel Strings C++ Python O(1) O(1) Medium Binomial Coefficients
1643 Kth Smallest Instructions C++ Python O((m + n)^2) O(1) Hard Binomial Coefficients
1735 Count Ways to Make Array With Product C++ Python O(nlogn) O(logn) Hard Binomial Coefficients, Euler's Theorem, Modular Inverse
1739 Building Boxes C++ Python O(1) O(1) Hard
1744 Can You Eat Your Favorite Candy on Your Favorite Day? C++ Python O(n) O(n) Medium Prefix Sum
1753 Maximum Score From Removing Stones C++ Python O(1) O(1) Medium
1776 Car Fleet II C++ Python O(n) O(n) Hard Mono Stack
1780 Check if Number is a Sum of Powers of Three C++ Python O(logn) O(1) Medium
1806 Minimum Number of Operations to Reinitialize a Permutation C++ Python O(sqrt(n)) O(sqrt(n)) Medium Discrete Logarithm, Multiplicative Order
1808 Maximize Number of Nice Divisors C++ Python O(logn) O(1) Medium variant of Integer Break
1812 Determine Color of a Chessboard Square C++ Python O(1) O(1) Easy
1819 Number of Different Subsequences GCDs C++ Python O(n + mlogm) O(n) Hard
1822 Sign of the Product of an Array C++ Python O(n) O(1) Easy
1823 Find the Winner of the Circular Game C++ Python O(n) O(1) Medium
1828 Queries on Number of Points Inside a Circle C++ Python O(q * n) O(1) Medium
1830 Minimum Number of Operations to Make String Sorted C++ Python O(n) O(max_n) Hard Modular Inverse
1835 Find XOR Sum of All Pairs Bitwise AND C++ Python O(n) O(1) Hard
1837 Sum of Digits in Base K C++ Python O(logn) O(1) Easy
1860 Incremental Memory Leak C++ Python O(1) O(1) Medium GCJ2020 - Round 2
1862 Sum of Floored Pairs C++ Python O(nlogn) O(n) Hard
1863 Sum of All Subset XOR Totals C++ Python O(n) O(1) Easy
1884 Egg Drop With 2 Eggs and N Floors C++ Python O(1) O(1) Medium DP
1904 The Number of Full Rounds You Have Played C++ Python O(1) O(1) Medium
1916 Count Ways to Build Rooms in an Ant Colony C++ Python O(n) O(n) Hard DFS, Tree
1922 Count Good Numbers C++ Python O(logn) O(1) Medium
1945 Sum of Digits of String After Convert C++ Python O(n) O(1) Easy
1952 Three Divisors C++ Python O(sqrt(n)) O(1) Easy
1954 Minimum Garden Perimeter to Collect Enough Apples C++ Python O(1) O(1) Medium Binary Search, Cardano's Formula
1969 Minimum Non-Zero Product of the Array Elements C++ Python O(min(p, logM)) O(1) Medium
1979 Find Greatest Common Divisor of Array C++ Python O(n) O(1) Easy
1980 Find Unique Binary String C++ Python O(n) O(1) Medium Cantor Diagonalization
1982 Find Array Given Subset Sums C++ Python O(n * 2^n) O(1) Hard Math, DP, OrderedDict
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


Sort

# Title Solution Time Space Difficulty Tag Note
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 Math, Median, 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
1942 The Number of the Smallest Unoccupied Chair C++ Python O(nlogn) O(n) Medium Line Sweep, Heap
1943 Describe the Painting C++ Python O(nlogn) O(n) Medium Line Sweep
1968 Array With Elements Not Equal to Average of Neighbors C++ Python O(n) on average O(1) Medium variant of Wiggle Sort II Quick Select, Tri Partition
1985 Find the Kth Largest Integer in the Array C++ Python O(n) on average O(n) Medium Quick Select
1996 The Number of Weak Characters in the Game C++ Python O(nlogn) O(1) Medium
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


Two Pointers

# Title Solution Time Space Difficulty Tag Note
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
1984 Minimum Difference Between Highest and Lowest of K Scores C++ Python O(nlogn) O(1) Easy Two Pointers, Sliding Window
1989 Maximum Number of People That Can Be Caught in Tag C++ Python O(n) O(1) Medium 🔒 Greedy, Two Pointers, Sliding Window
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


Recursion

# Title Solution Time Space Difficulty Tag Note
1106 Parsing A Boolean Expression C++ Python O(n) O(n) Hard


Binary Search

# Title Solution Time Space Difficulty Tag Note
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 🔒
1964 Find the Longest Valid Obstacle Course at Each Position C++ Python O(nlogn) O(n) Hard variant of Longest Increasing Subsequence Binary Search, Segment Tree, DP
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


Binary Search Tree

# Title Solution Time Space Difficulty Tag Note
1373 Maximum Sum BST in Binary Tree C++ Python O(n) O(h) Hard DFS, Stack
1382 Balance a Binary Search Tree C++ Python O(n) O(h) Medium DFS, Stack
1902 Depth of BST Given Insertion Order C++ Python O(nlogn) O(n) Medium 🔒 Sorted Dict
1932 Merge BSTs to Create Single BST C++ Python O(n) O(n) Hard BST, BFS


Breadth-First Search

# Title Solution Time Space Difficulty Tag Note
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
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


Depth-First Search

# Title Solution Time Space Difficulty Tag Note
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
1973 Count Nodes Equal to Sum of Descendants C++ Python O(n) O(h) Medium 🔒
2049 Count Nodes With the Highest Score C++ Python O(n) O(n) Medium
2065 Maximum Path Quality of a Graph C++ Python O(|V| + |E| + 4^10) O(|V| + |E| ) Hard Pruning
2192 All Ancestors of a Node in a Directed Acyclic Graph C++ Python O(|V| * |E|) O(|V| + |E|) Medium DFS, BFS, Topological Sort
2246 Longest Path With Different Adjacent Characters C++ Python O(n) O(h) Hard DFS, BFS, Topological Sort


Backtracking

# Title Solution Time Space Difficulty Tag Note
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
1999 Smallest Greater Multiple Made of Two Digits C++ Python O(1) O(1) Medium 🔒 Backtracking, Bit Manipulation
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


Dynamic Programming

# Title Solution Time Space Difficulty Tag Note
1027 Longest Arithmetic Sequence C++ Python O(n^2) O(n^2) Medium
1035 Uncrossed Lines C++ Python O(m * n) O(min(m, n)) Medium
1039 Minimum Score Triangulation of Polygon C++ Python O(n^3) O(n^2) Medium
1043 Partition Array for Maximum Sum C++ Python O(n * k) O(k) Medium
1048 Longest String Chain C++ Python O(n * l^2) O(n * l) Medium
1049 Last Stone Weight II C++ Python O(2^n) O(2^n) Medium
1066 Campus Bikes II C++ Python O(w * b * 2^b) O(w * b * 2^b) Medium 🔒
1092 Shortest Common Supersequence C++ Python O(m * n) O(m * n) Hard
1105 Filling Bookcase Shelves C++ Python O(n^2) O(n) Medium
1125 Smallest Sufficient Team C++ Python O(m * 2^n) O(2^n) Hard
1137 N-th Tribonacci Number C++ Python O(logn) O(1) Easy variant of Fibonacci Number Matrix Exponentiation
1139 Largest 1-Bordered Square C++ Python O(n^3) O(n^2) Medium
1140 Stone Game II C++ Python O(n*(logn)^2) O(nlogn) Medium
1143 Longest Common Subsequence C++ Python O(m * n) O(min(m, n)) Medium
1155 Number of Dice Rolls With Target Sum C++ Python O(d * f * t) O(t) Medium
1182 Shortest Distance to Target Color C++ Python O(n) O(n) Medium 🔒
1186 Maximum Subarray Sum with One Deletion C++ Python O(n) O(1) Medium
1187 Make Array Strictly Increasing C++ Python O(n^2 * logn) O(n) Hard
1191 K-Concatenation Maximum Sum C++ Python O(n) O(1) Medium
1216 Valid Palindrome III C++ Python O(n^2) O(n) Hard 🔒, variant of Longest Palindromic Subsequence
1218 Longest Arithmetic Subsequence of Given Difference C++ Python O(n) O(n) Medium
1220 Count Vowels Permutation C++ Python O(logn) O(1) Hard Matrix Exponentiation
1223 Dice Roll Simulation C++ Python O(m * n) O(m) Medium
1230 Toss Strange Coins C++ Python O(n^2) O(n) Medium
1235 Maximum Profit in Job Scheduling C++ Python O(nlogn) O(n) Hard DP, Heap
1239 Maximum Length of a Concatenated String with Unique Characters C++ Python O(n) ~ O(2^n) O(1) ~ O(2^n) Medium DP, Bit Manipulation
1246 Palindrome Removal C++ Python O(n^3) O(n^2) Hard
1262 Greatest Sum Divisible by Three C++ Python O(n) O(1) Medium
1269 Number of Ways to Stay in the Same Place After Some Steps C++ Python O(n^2) O(n) Hard
1277 Count Square Submatrices with All Ones C++ Python O(m * n) O(1) Medium
1278 Palindrome Partitioning III C++ Python O(k * n^2) O(n^2) Hard
1289 Minimum Falling Path Sum II C++ Python O(m * n) O(1) Hard
1292 Maximum Side Length of a Square with Sum Less than or Equal to Threshold C++ Python O(m * n * log(min(m, n))) O(m * n) Medium Binary Search
1301 Number of Paths with Max Score C++ Python O(n^2) O(n) Hard
1312 Minimum Insertion Steps to Make a String Palindrome C++ Python O(n^2) O(n) Hard variant of Longest Common Subsequence
1314 Matrix Block Sum C++ Python O(m * n) O(m * n) Medium variant of Range Sum Query 2D - Immutable
1320 Minimum Distance to Type a Word Using Two Fingers C++ Python O(n) O(1) Hard
1335 Minimum Difficulty of a Job Schedule C++ Python O(d * n^2) O(d * n) Hard
1340 Jump Game V C++ Python O(n) O(n) Hard Sliding Window, Mono Stack, Segment Tree
1387 Sort Integers by The Power Value C++ Python O(n) on average O(n) Medium Quick Select
1388 Pizza With 3n Slices C++ Python O(n^2) O(n) Hard variant of House Robber II
1395 Count Number of Teams C++ Python O(n^2) O(1) Medium
1397 Find All Good Strings C++ Python O(m * n) O(m) Hard KMP Algorithm
1406 Stone Game III C++ Python O(n) O(1) Hard
1411 Number of Ways to Paint N × 3 Grid C++ Python O(logn) O(1) Hard Matrix Exponentiation
1416 Restore The Array C++ Python O(nlogk) O(logk) Hard
1420 Build Array Where You Can Find The Maximum Exactly K Comparisons C++ Python O(n * m * k) O(m * k) Hard
1434 Number of Ways to Wear Different Hats to Each Other C++ Python O(h * 2^n) O(2^n) Hard
1444 Number of Ways of Cutting a Pizza C++ Python O(m * n * k * (m + n)) O(m * n * k) Hard
1449 Form Largest Integer With Digits That Add up to Target C++ Python O(t) O(t) Hard
1458 Max Dot Product of Two Subsequences C++ Python O(m * n) O(min(m, n)) Hard
1463 Cherry Pickup II C++ Python O(m * n^2) O(n^2) Hard
1467 Probability of a Two Boxes Having The Same Number of Distinct Balls C++ Python O(k^3 * n^2) O(k^2 * n) Hard Binomial Coefficients
1473 Paint House III C++ Python O(m * t * n^2) O(t * n) Hard
1477 Find Two Non-overlapping Sub-arrays Each With Target Sum C++ Python O(n) O(n) Medium
1478 Allocate Mailboxes C++ Python O(m * n^2) O(n) Hard DP, Math, Median
1494 Parallel Courses II C++ Python O((n * C(c, min(c, k))) * 2^n) O(2^n) Hard Combinations
1504 Count Submatrices With All Ones C++ Python O(m * n) O(n) Medium Mono Stack
1510 Stone Game IV C++ Python O(n * sqrt(n)) O(n) Hard
1524 Number of Sub-arrays With Odd Sum C++ Python O(n) O(1) Medium
1531 String Compression II C++ Python O(n^2 * k) O(n * k) Hard
1547 Minimum Cost to Cut a Stick C++ Python O(n^3) O(n^2) Hard
1548 The Most Similar Path in a Graph C++ Python O(n^ * m) O(n * m) Hard 🔒
1553 Minimum Number of Days to Eat N Oranges C++ Python O((logn)^2) O((logn)^2) Hard
1563 Stone Game V C++ Python O(n^2) O(n^2) Hard
1569 Number of Ways to Reorder Array to Get Same BST C++ Python O(n^2) O(n^2) Hard DFS
1575 Count All Possible Routes C++ Python O(nlogn + n * f) O(n * f) Hard Math
1594 Maximum Non Negative Product in a Matrix C++ Python O(m * n) O(n) Medium
1595 Minimum Cost to Connect Two Groups of Points C++ Python O(m * n * 2^n) O(2^n) Hard
1617 Count Subtrees With Max Distance Between Cities C++ Python O(n^6) O(n^3) Hard Backtracking, Graph
1626 Best Team With No Conflicts C++ Python O(nloga) O(n) Medium variant of Longest Increasing Subsequence Sort, DP, Segment Tree
1639 Number of Ways to Form a Target String Given a Dictionary C++ Python O(l * (w + n)) O(n) Hard
1655 Distribute Repeating Integers C++ Python O(n + m * 3^m) O(n + 2^m) Hard Submask Enumeration
1664 Ways to Make a Fair Array C++ Python O(n) O(1) Medium Prefix Sum
1681 Minimum Incompatibility C++ Python O(max(n * 2^n, 3^n)) O(2^n) Hard Combinations, Backtracking, Submask Enumeration
1682 Longest Palindromic Subsequence II C++ Python O(n^2) O(n) Medium 🔒
1690 Stone Game VII C++ Python O(n^2) O(n) Medium
1691 Maximum Height by Stacking Cuboids C++ Python O(n^2) O(n) Hard
1692 Count Ways to Distribute Candies C++ Python O(n * k) O(k) Hard 🔒
1745 Palindrome Partitioning IV C++ Python O(n^2) O(n) Hard DP, Manacher's Algorithm
1746 Maximum Subarray Sum After One Operation C++ Python O(n) O(1) Medium variant of Maximum Subarray, 🔒
1751 Maximum Number of Events That Can Be Attended II C++ Python O(nlogn + n * k) O(n * k) Hard Binary Search
1770 Maximum Score from Performing Multiplication Operations C++ Python O(m^2) O(m) Medium
1771 Maximize Palindrome Length From Subsequences C++ Python O((m + n)^2) O((m + n)^2) Hard
1774 Closest Dessert Cost C++ Python O(m * t) O(t) Medium
1787 Make the XOR of All Segments Equal to Zero C++ Python O(n + k * m) O(min(k * m, n)) Hard
1799 Maximize Score After N Operations C++ Python O(n^2 * 2^n) O(2^n) Hard
1803 Count Pairs With XOR in a Range C++ Python O(n) O(n) Hard DP, Trie
1857 Largest Color Value in a Directed Graph C++ Python O(n + m) O(n + m) Hard DP, Topological Sort
1866 Number of Ways to Rearrange Sticks With K Sticks Visible C++ Python O(n * k) O(k) Hard
1871 Jump Game VII C++ Python O(n) O(n) Medium Line Sweep, DP, BFS
1872 Stone Game VIII C++ Python O(n) O(1) Hard
1883 Minimum Skips to Arrive at Meeting On Time C++ Python O(n^2) O(n) Hard
1896 Minimum Cost to Change the Final Value of Expression C++ Python O(n) O(n) Hard Stack, DP
1900 The Earliest and Latest Rounds Where Players Compete C++ Python O(n^4) O(n^2) Hard
1908 Game of Nim C++ Python O(n) O(1) Medium 🔒
1931 Painting a Grid With Three Different Colors C++ Python O(2^(3 * m) * logn) O(2^(2 * m)) Hard variant of Number of Ways to Paint N × 3 Grid DP, Backtracking, Matrix Exponentiation, State Compression
1937 Maximum Number of Points with Cost C++ Python O(m * n) O(n) Medium Prefix Sum
1955 Count Number of Special Subsequences C++ Python O(n) O(1) Hard
1959 Minimum Total Space Wasted With K Resizing Operations C++ Python O(k * n^2) O(k * n) Medium
1960 Maximum Product of the Length of Two Palindromic Substrings C++ Python O(n) O(n) Hard Manacher's Algorithm, DP
1977 Number of Ways to Separate Numbers C++ Python O(n^2) O(n^2) Hard DP
1981 Minimize the Difference Between Target and Chosen Elements C++ Python O(t * m * n) O(t) Medium DP, Pruning
1986 Minimum Number of Work Sessions to Finish the Tasks C++ Python O(n * 2^n) O(2^n) Medium DP
1987 Number of Unique Good Subsequences C++ Python O(n) O(1) Hard variant of Distinct Subsequences II DP
1994 The Number of Good Subsets C++ Python O(n * 2^p) O(2^p) Hard DP, Sieve of Eratosthenes
1997 First Day Where You Have Been in All the Rooms C++ Python O(n) O(n) Medium DP
2002 Maximum Product of the Length of Two Palindromic Subsequences C++ Python O(3^n) O(2^n) Medium DP, Submask Enumeration
2008 Maximum Earnings From Taxi C++ Python O(n + mlogm) O(n) Medium DP
2019 The Score of Students Solving Math Expression C++ Python O(n^3 * a^2) O(n^2) Hard variant of Burst Balloons
2031 Count Subarrays With More Ones Than Zeros C++ Python O(n) O(n) Medium 🔒 Prefix Sum, DP
2044 Count Number of Maximum Bitwise-OR Subsets C++ Python O(min(2^n, m * n)) O(min(2^n, m)) Medium DP
2052 Minimum Cost to Separate Sentence Into Rows C++ Python O(s + n * k) O(k) Medium 🔒 DP
2060 Check if an Original String Exists Given Two Encoded Strings C++ Python O(m * n * k) O(min(m, n) * k) Hard DP, Memoization
2088 Count Fertile Pyramids in a Land C++ Python O(m * n) O(n) Hard DP
2140 Solving Questions With Brainpower C++ Python O(n) O(n) Medium DP
2143 Choose Numbers From Two Arrays in Range C++ Python O(n^2 * v) O(n * v) Hard 🔒 DP
2167 Minimum Time to Remove All Cars Containing Illegal Goods C++ Python O(n) O(1) Hard DP
2174 Remove All Ones With Row and Column Flips II C++ Python O((m * n) * 2^(m * n)) O(2^(m * n)) Medium 🔒 DP, Bitmasks
2184 Number of Ways to Build Sturdy Brick Wall C++ Python O(h * p^2) O(p^2) Medium 🔒, variant of Painting a Grid With Three Different Colors DP, Backtracking, Matrix Exponentiation
2188 Minimum Time to Finish the Race C++ Python O((n + l) * logc) O(n + l + logc) Hard Greedy, DP
2189 Number of Ways to Build House of Cards C++ Python O(n^2) O(n) Medium 🔒 DP
2209 Minimum White Tiles After Covering With Carpets C++ Python O(m * n) O(m * n) Hard DP
2218 Maximum Value of K Coins From Piles C++ Python O(min(n * k^2, m * k))) O(k) Hard DP
2222 Number of Ways to Select Buildings C++ Python O(n) O(1) Medium DP
2247 Maximum Cost of Trip With K Highways C++ Python O(n^2 * 2^n) O(n * 2^n) Hard 🔒 DP, Bitmasks, BFS


Greedy

# Title Solution Time Space Difficulty Tag Note
1005 Maximize Sum Of Array After K Negations C++ Python O(n) on average O(1) Easy Quick Select
1024 Video Stitching C++ Python O(nlogn) O(1) Medium variant of Jump Game II
1029 Two City Scheduling C++ Python O(n) on average O(1) Easy Quick Select
1053 Previous Permutation With One Swap C++ Python O(n) O(1) Medium
1055 Shortest Way to Form String C++ Python O(m + n) O(m) Medium 🔒, variant of Minimum Window Subsequence
1058 Minimize Rounding Error to Meet Target C++ Python O(n) on average O(n) Medium 🔒 Quick Select
1081 Smallest Subsequence of Distinct Characters C++ Python O(n) O(1) Medium same as Remove Duplicate Letters Mono Stack
1090 Largest Values From Labels C++ Python O(nlogn) O(n) Medium
1111 Maximum Nesting Depth of Two Valid Parentheses Strings C++ Python O(n) O(1) Medium
1163 Last Substring in Lexicographical Order C++ Python O(n) O(1) Hard
1167 Minimum Cost to Connect Sticks C++ Python O(nlogn) O(n) Medium 🔒
1183 Maximum Number of Ones C++ Python O(1) O(1) Hard 🔒
1196 How Many Apples Can You Put into the Basket C++ Python O(nlogn) O(n) Easy 🔒
1199 Minimum Time to Build Blocks C++ Python O(nlogn) O(n) Hard 🔒
1221 Split a String in Balanced Strings C++ Python O(n) O(1) Easy
1247 Minimum Swaps to Make Strings Equal C++ Python O(n) O(1) Easy
1249 Minimum Remove to Make Valid Parentheses C++ Python O(n) O(1) Medium Stack
1253 Reconstruct a 2-Row Binary Matrix C++ Python O(n) O(1) Medium
1272 Remove Interval C++ Python O(n) O(1) Medium Line Sweep
1282 Group the People Given the Group Size They Belong To C++ Python O(n) O(n) Medium
1288 Remove Covered Intervals C++ Python O(nlogn) O(1) Medium Line Sweep
1296 Divide Array in Sets of K Consecutive Numbers C++ Python O(nlogn) O(n) Medium
1326 Minimum Number of Taps to Open to Water a Garden C++ Python O(n) O(n) Hard variant of Jump Game II
1338 Reduce Array Size to The Half C++ Python O(n) O(n) Medium Counting Sort
1353 Maximum Number of Events That Can Be Attended C++ Python O(r + nlogn) O(n) Medium Heap, Sort
1354 Construct Target Array With Multiple Sums C++ Python O(log(max(t)) * logn) O(n) Hard Heap
1386 Cinema Seat Allocation C++ Python O(n) O(n) Medium
1400 Construct K Palindrome Strings C++ Python O(n) O(1) Medium
1402 Reducing Dishes C++ Python O(nlogn) O(1) Hard
1403 Minimum Subsequence in Non-Increasing Order C++ Python O(nlogn) O(1) Easy
1405 Longest Happy String C++ Python O(n) O(1) Medium
1414 Find the Minimum Number of Fibonacci Numbers Whose Sum Is K C++ Python O(logk) O(1) Medium
1419 Minimum Number of Frogs Croaking C++ Python O(n) O(1) Medium
1433 Check If a String Can Break Another String C++ Python O(n) O(1) Medium
1488 Avoid Flood in The City C++ Python O(nlogn) O(n) Medium
1518 Water Bottles C++ Python O(logn/logm) O(1) Easy
1520 Maximum Number of Non-Overlapping Substrings C++ Python O(n) O(1) Medium
1526 Minimum Number of Increments on Subarrays to Form a Target Array C++ Python O(n) O(1) Hard
1536 Minimum Swaps to Arrange a Binary Grid C++ Python O(n^2) O(1) Medium
1546 Maximum Number of Non-Overlapping Subarrays With Sum Equals Target C++ Python O(n) O(n) Medium
1564 Put Boxes Into the Warehouse I C++ Python O(nlogn) O(1) Medium 🔒
1567 Maximum Length of Subarray With Positive Product C++ Python O(n) O(1) Medium
1568 Minimum Number of Days to Disconnect Island C++ Python O(m^2 * n^2) O(m * n) Medium DFS
1578 Minimum Deletion Cost to Avoid Repeating Letters C++ Python O(n) O(1) Medium
1580 Put Boxes Into the Warehouse II C++ Python O(nlogn) O(1) Medium 🔒
1585 Check If String Is Transformable With Substring Sort Operations C++ Python O(n) O(n) Hard
1589 Maximum Sum Obtained of Any Permutation C++ Python O(nlogn) O(n) Medium
1591 Strange Printer II C++ Python O(c * m * n + e) O(e) Hard
1599 Maximum Profit of Operating a Centennial Wheel C++ Python O(n) O(1) Medium
1605 Find Valid Matrix Given Row and Column Sums C++ Python O(m + n) O(1) Medium
1616 Split Two Strings to Make Palindrome C++ Python O(n) O(1) Medium Two Pointers
1632 Rank Transform of a Matrix C++ Python O(m * n * log(m * n)) O(m * n) Hard Union Find
1647 Minimum Deletions to Make Character Frequencies Unique C++ Python O(n) O(1) Medium
1653 Minimum Deletions to Make String Balanced C++ Python O(n) O(1) Medium
1663 Smallest String With A Given Numeric Value C++ Python O(n) O(1) Medium
1665 Minimum Initial Energy to Finish Tasks C++ Python O(nlogn) O(1) Hard
1673 Find the Most Competitive Subsequence C++ Python O(n) O(k) Meidum Stack, Greedy
1674 Minimum Moves to Make Array Complementary C++ Python O(n + k) O(k) Meidum
1686 Stone Game VI C++ Python O(nlogn) O(n) Medium
1689 Partitioning Into Minimum Number Of Deci-Binary Numbers C++ Python O(n) O(1) Medium
1702 Maximum Binary String After Change C++ Python O(n) O(1) Medium
1705 Maximum Number of Eaten Apples C++ Python O(nlogn) O(n) Medium Heap
1708 Largest Subarray Length K C++ Python O(n) O(1) Easy 🔒, variant of Last Substring in Lexicographical Order
1710 Maximum Units on a Truck C++ Python O(nlogn) O(1) Easy
1717 Maximum Score From Removing Substrings C++ Python O(n) O(1) Medium
1725 Number Of Rectangles That Can Form The Largest Square C++ Python O(n) O(1) Easy
1727 Largest Submatrix With Rearrangements C++ Python O(m * nlogn) O(1) Medium Sort
1733 Minimum Number of People to Teach C++ Python O(n * m^2) O(n * m) Medium
1736 Latest Time by Replacing Hidden Digits C++ Python O(1) O(1) Easy
1737 Change Minimum Characters to Satisfy One of Three Conditions C++ Python O(m + n) O(1) Medium Prefix Sum
1749 Maximum Absolute Sum of Any Subarray C++ Python O(n) O(1) Medium variant of Maximum Subarray Prefix Sum
1754 Largest Merge Of Two Strings C++ Python O(m * n) O(m + n) Medium
1758 Minimum Changes To Make Alternating Binary String C++ Python O(n) O(1) Easy
1759 Count Number of Homogenous Substrings C++ Python O(n) O(1) Medium
1762 Buildings With an Ocean View C++ Python O(n) O(1) Medium 🔒
1764 Form Array by Concatenating Subarrays of Another Array C++ Python O(n) O(n) Medium KMP Algorithm
1769 Minimum Number of Operations to Move All Balls to Each Box C++ Python O(n) O(1) Medium
1775 Equal Sum Arrays With Minimum Number of Operations C++ Python O(m + n) O(1) Medium
1785 Minimum Elements to Add to Form a Given Sum C++ Python O(n) O(1) Medium
1788 Maximize the Beauty of the Garden C++ Python O(n) O(n) Hard 🔒
1793 Maximum Score of a Good Subarray C++ Python O(n) O(1) Hard Greedy, Prefix Sum. Binary Search
1794 Count Pairs of Equal Substrings With Minimum Difference C++ Python O(n) O(1) Medium 🔒
1798 Maximum Number of Consecutive Values You Can Make C++ Python O(nlogn) O(1) Medium
1801 Number of Orders in the Backlog C++ Python O(nlogn) O(n) Medium Greedy, Heap
1815 Maximum Number of Groups Getting Fresh Donuts C++ Python O((b/2) * (n/(b/2)+1)^(b/2)) O((n/(b/2)+1)^(b/2)) Hard Greedy, DP
1824 Minimum Sideway Jumps C++ Python O(n) O(1) Medium Greedy, DP
1827 Minimum Operations to Make the Array Increasing C++ Python O(n) O(1) Easy
1833 Maximum Ice Cream Bars C++ Python O(nlogn) O(1) Medium
1840 Maximum Building Height C++ Python O(nlogn) O(1) Hard
1842 Next Palindrome Using Same Digits C++ Python O(n) O(1) Hard 🔒
1846 Maximum Element After Decreasing and Rearranging C++ Python O(nlogn) O(1) Medium
1850 Minimum Adjacent Swaps to Reach the Kth Smallest Number C++ Python O((k + n) * n) O(n) Medium
1864 Minimum Number of Swaps to Make the Binary String Alternating C++ Python O(n) O(1) Medium
1874 Minimize Product Sum of Two Arrays C++ Python O(nlogn) O(1) Medium GCJ2008 - Round 1A, 🔒
1877 Minimize Maximum Pair Sum in Array C++ Python O(nlogn) O(1) Medium
1881 Maximum Value after Insertion C++ Python O(n) O(1) Medium
1887 Reduction Operations to Make the Array Elements Equal C++ Python O(nlogn) O(1) Medium Sort
1893 Check if All the Integers in a Range Are Covered C++ Python O(n + r) O(r) Easy Line Sweep, Sort
1894 Find the Student that Will Replace the Chalk C++ Python O(n) O(1) Medium
1897 Redistribute Characters to Make All Strings Equal C++ Python O(n) O(1) Easy
1899 Merge Triplets to Form Target Triplet C++ Python O(n) O(1) Medium
1911 Maximum Alternating Subsequence Sum C++ Python O(n) O(1) Medium variant of Best Time to Buy and Sell Stock II
1913 Maximum Product Difference Between Two Pairs C++ Python O(n) O(1) Medium
1921 Eliminate Maximum Number of Monsters C++ Python O(nlogn) O(1) Medium
1927 Sum Game C++ Python O(n) O(1) Medium
1936 Add Minimum Number of Rungs C++ Python O(n) O(1) Medium
1946 Largest Number After Mutating Substring C++ Python O(n) O(1) Medium
1953 Maximum Number of Weeks for Which You Can Work C++ Python O(n) O(1) Medium
1975 Maximum Matrix Sum C++ Python O(n^2) O(1) Medium
2027 Minimum Moves to Convert String C++ Python O(n) O(1) Easy
2030 Smallest K-Length Subsequence With Occurrences of a Letter C++ Python O(n) O(n) Hard Mono Stack, Greedy
2036 Maximum Alternating Subarray Sum C++ Python O(n) O(1) Medium variant of Maximum Alternating Subsequence Sum, 🔒 Greedy, Kadane's Algorithm
2037 Minimum Number of Moves to Seat Everyone C++ Python O(nlogn) O(1) Easy Greedy
2071 Maximum Number of Tasks You Can Assign C++ Python O(n * (logn)^2) O(n) Hard Greedy, Binary Search, Sorted List
2086 Minimum Number of Buckets Required to Collect Rainwater from Houses C++ Python O(n) O(1) Medium Greedy
2087 Minimum Cost Homecoming of a Robot in a Grid C++ Python O(m + n) O(1) Medium Greedy
2126 Destroying Asteroids C++ Python O(nlogn) O(1) Medium Greedy
2136 Earliest Possible Day of Full Bloom C++ Python O(nlogn) O(n) Hard Greedy
2139 Minimum Moves to Reach Target Score C++ Python O(logn) O(1) Medium
2141 Maximum Running Time of N Computers C++ Python O(nlogm) O(1) Hard Greedy, Binary Search
2144 Minimum Cost of Buying Candies With Discount C++ Python O(nlogn) O(1) Easy Greedy, Sort
2147 Number of Ways to Divide a Long Corridor C++ Python O(n) O(1) Hard Greedy, Combinatorics
2160 Minimum Sum of Four Digit Number After Splitting Digits C++ Python O(1) O(1) Easy Greedy
2165 Smallest Value of the Rearranged Number C++ Python O(d) O(d) Medium Greedy, Counting Sort
2178 Maximum Split of Positive Even Integers C++ Python O(sqrt(n)) O(1) Medium Greedy
2182 Construct String With Repeat Limit C++ Python O(n) O(1) Medium Greedy
2193 Minimum Number of Moves to Make Palindrome C++ Python O(nlogn) O(n) Hard Greedy, BIT, Fenwick Tree
2195 Append K Integers With Minimal Sum C++ Python O(nlogn) O(n) Medium Greedy
2207 Maximize Number of Subsequences in a String C++ Python O(n) O(1) Medium Counting, Greedy
2214 Minimum Health to Beat Game C++ Python O(n) O(1) Medium 🔒 Greedy
2216 Minimum Deletions to Make Array Beautiful C++ Python O(n) O(1) Medium Greedy
2224 Minimum Number of Operations to Convert Time C++ Python O(1) O(1) Easy Greedy


Graph

# Title Solution Time Space Difficulty Tag Note
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
1349 Maximum Students Taking Exam C++ Python O(m * n * sqrt(m * n)) O(m + n) Hard GCJ2008 - Round 3 Hopcroft-Karp Bipartite Matching, Hungarian Bipartite Matching, Maximum Independent Set
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
1947 Maximum Compatibility Score Sum C++ Python O(m^2 * (n + m)) O(m^2) Medium variant of Minimum XOR Sum of Two Arrays DP, Hungarian Weighted Bipartite Matching
1971 Find if Path Exists in Graph C++ Python O(|V| + |E|) O(|V| + |E|) Easy DFS, BFS, Bi-BFS
1976 Number of Ways to Arrive at Destination C++ Python O(|E| * log|V|) O(|E|) Medium Dijkstra's Algorithm
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


Geometry

# Title Solution Time Space Difficulty Tag Note
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
1956 Minimum Time For K Virus Variants to Spread C++ Python O(nlogn * logr) O(n) Hard 🔒 Geometry, Binary Search, Line Sweep, Segment Tree, Coordinate Compression
2101 Detonate the Maximum Bombs C++ Python O(|V|^2 + \V| * |E|) O(\V| + |E|) Medium Graph, DFS, BFS


Simulation

# Title Solution Time Space Difficulty Tag Note
1138 Alphabet Board Path C++ Python O(n) O(1) Medium
1243 Array Transformation C++ Python O(n^2) O(n) Easy
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


Design

# Title Solution Time Space Difficulty Tag Note
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 🔒 Sorted List, 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 Sorted List
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
1993 Operations on Tree C++ Python ctor: O(n)
lock: O(1)
unlock: O(1)
upgrade: O(n)
O(n) Medium
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


Concurrency

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


SQL

# Title Solution Time Space Difficulty Tag Note
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(nlogn) 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 🔒
1939 Users That Actively Request Confirmation Messages MySQL O(nlogn) O(n) Easy 🔒
1949 Strong Friendship MySQL O(n^3) O(n^2) Medium 🔒
1951 All the Pairs With the Maximum Number of Common Followers MySQL O(n^3) O(n^2) Medium 🔒
1965 Employees With Missing Information MySQL O(nlogn) O(n) Easy 🔒
1972 First and Last Call On the Same Day MySQL O(n) O(n) Hard 🔒
1978 Employees Whose Manager Left the Company MySQL O(nlogn) O(n) Easy 🔒
1988 Find Cutoff Score for Each School MySQL O(n * m) O(n * m) Medium 🔒
1990 Count the Number of Experiments MySQL O(n) O(n) Easy 🔒
2004 The Number of Seniors and Juniors to Join the Company MySQL O(nlogn) O(n) Hard 🔒
2010 The Number of Seniors and Juniors to Join the Company II MySQL O(nlogn) O(n) Hard 🔒
2020 Number of Accounts That Did Not Stream MySQL O(m + n) O(m + n) Medium 🔒
2026 Low-Quality Problems MySQL O(nlogn) O(n) Easy 🔒
2041 Accepted Candidates From the Interviews MySQL O(m + n) O(m + n) Medium 🔒
2051 The Category of Each Member in the Store MySQL O(m + n) O(m + n) Medium 🔒
2066 Account Balance MySQL O(nlogn) O(n) Medium 🔒
2072 The Winner University MySQL O(n) O(n) Easy 🔒
2082 The Number of Rich Customers MySQL O(n) O(n) Easy 🔒
2084 Drop Type 1 Orders for Customers With Type 0 Orders MySQL O(nlogn) O(n) Medium 🔒
2112 The Airport With the Most Traffic MySQL O(n) O(n) Medium 🔒
2118 Build the Equation MySQL O(nlogn) O(n) Hard 🔒
2142 The Number of Passengers in Each Bus I MySQL O(p * b + blogb) O(p * b) Medium 🔒
2153 The Number of Passengers in Each Bus II MySQL O(p * b + blogb) O(p * b) Hard 🔒
2159 Order Two Columns Independently MySQL O(nlogn) O(n) Medium 🔒
2173 Longest Winning Streak MySQL O(nlogn) O(n) Hard 🔒
2175 The Change in Global Rankings MySQL O(nlogn) O(n) Medium 🔒
2199 Finding the Topic of Each Post MySQL O(n * mlogm) O(n * m) Hard 🔒
2205 The Number of Users That Are Eligible for Discount MySQL O(n) O(n) Easy 🔒
2228 Users With Two Purchases Within Seven Days MySQL O(nlogn) O(n) Medium 🔒
2230 The Users That Are Eligible for Discount MySQL O(nlogn) O(n) Easy 🔒
2238 Number of Times a Driver Was a Passenger MySQL O(n) O(n) Medium 🔒
2252 Dynamic Pivoting of a Table MySQL O(n * m) O(n * m) Hard 🔒
2253 Dynamic Unpivoting of a Table MySQL O(n * m) O(n * m) Hard 🔒


Shell Script

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


More Repositories

1

Cracking-the-Coding-Interview

Learn how to uncover the hints and hidden details in a question, discover how to break down a problem into manageable chunks, develop techniques to unstick yourself when stuck, learn (or re-learn) core computer science concepts, and practice on 189 interview questions and solutions.
C++
314
star
2

InterviewBit-Topicwise-Solutions

The repository contains solutions to various problems on interviewbit. The code is merely a snippet (as solved on InterviewBit) & hence is not executable in a c++ compiler. The code written is purely original and completely my own.
C++
310
star
3

Cheat-Sheets

A cheat sheet can be really helpful when you're trying a set of exercises related to a specific topic, or working on a project. Because you can only fit so much information on a single sheet of paper, most cheat sheets are a simple listing of syntax rules. This set of cheat sheets aims to remind you of syntax rules, but also remind you of important concepts as well.
Jupyter Notebook
150
star
4

System-Design

System design always seemed quite far from reach because the knowledge available online either is too shallow or basic, or quite high level. Facing challenges head-on and building robust systems. If you feel the same, then this repository is perfect for you!
37
star
5

Attendance-Using-Face-Recognition

Human face detection and recognition is an important technology used in various applications such as video monitor system. Traditional method for taking attendance is Roll Number of student and record the attendance in sheet which takes a lot of time. Because of that systems like automatic attendance is used. To overcome the problems like wastage of time, incorrect attendance, the proposed system gives a method like when he enters the class room , system marks the attendance by extracting the image using Principal Component Analysis algorithm. The system will record the attendance of the student automatically. The student database is collected, it includes name of the students, there images and roll number. It carries an entry in log report of every student of each subject and generates a PDF report of the attendance of the student.
28
star
6

Virtual-Piano

Pianos are large instruments that cannot be carried everywhere. So we are introducing Virtual Piano(can be carried easily) which will detect fingers motions in real time with the help of raspberry pi attached to the camera. Corresponding to detected fingers it will fetch the tone from the database and simulate through speaker.
10
star
7

Virtual-Assistant-Using-Google-API-In-Python

An attempt to make a very simple, Personal Assistant that understands speech as well as text input and is capable of performing tasks other than conversing. It performs basic functionalities with required internet connection.
Python
9
star
8

Capture-Multiple-Images-Using-Python-Script

This contains script for capturing images continuously.This was needed for Attendance using Facial Recognition project for training face recognition model with good accuracy.
Python
7
star
9

Counting-Fingers-Using-Image-Processing-In-MATLAB

This project used Matlab and the Centre for Image Processing and Analysis VSG toolbox to count the number of fingers on a number of hands by using geometric isolation to cut off the palm, converting the picture to black and white and counting the resulting number of white strips (fingers).
MATLAB
7
star
10

Product-Security-System

This repository consists of a Database Management Project which will help people peoples to find anything they have lost. The idea behind is project is small scale thus it can be implemented on the places like universities etc.
5
star