Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

🏋️ Python / Modern C++ Solutions of All 2573 LeetCode Problems (Weekly Update)

License

NotificationsYou must be signed in to change notification settings

coderpick/LeetCode-Solutions

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Language License Update Progress SayThanks Visitors

  • R.I.P. to my old Leetcode repository, where there were5.7k+ stars and2.2k+ forks (ever the top 3 in the field).
  • Since free questions may be even mistakenly taken down by some companies, only solutions will be post on now.
  • There are new LeetCode questions every week. I'll keep updating for full summary and better solutions.
  • For more problem solutions, you can see myLintCode,GoogleKickStart,GoogleCodeJamIO repositories.
  • For more challenging problem solutions, you can also see myGoogleCodeJam,MetaHackerCup repositories.
  • Hope you enjoy the journey of learning data structures and algorithms.
  • Notes: "🔒" means your subscription ofLeetCode premium membership is required for reading the question.

Solutions

Algorithms

Database

Shell

Reference

nComplexityPossible Algorithms & Techniques
1018+O(1)Math
1018O(logn)Binary & Ternary Search / Matrix Power / Cycle Tricks / Big Simulation Steps / Values Reranking / Math
1016O(n1/2)Math
108O(n)Greedy / Ad-hoc / DP
4×107O(nlogn)Linear # Calls to Binary & Ternary Search / Pre-processing & Querying / Divide and Conquer
104O(n2)Ad-hoc / DP / Greedy / Divide and Conquer / Branch and Bound
500O(n3)Ad-hoc / DP / Greedy / Divide and Conquer / Branch and Bound
90O(n4)Ad-hoc / DP / Greedy / Divide and Conquer / Branch and Bound
50O(n5)Branch and Bound
40O(n×2n/2)Meet in the Middle
20O(n×2n)Backtracking / Generating 2n Subsets / Bitmask Technique
11O(n!)Factorial / Permutation / Combination Algorithm

Bit Manipulation

#TitleSolutionTimeSpaceDifficultyTagNote
1310XOR Queries of a SubarrayC++PythonO(n)O(1)Medium
1318Minimum Flips to Make a OR b Equal to cC++PythonO(1)O(1)Medium
1342Number of Steps to Reduce a Number to ZeroC++PythonO(logn)O(1)Easy
1558Minimum Numbers of Function Calls to Make Target ArrayC++PythonO(nlogn)O(1)MediumGreedy
1707Maximum XOR With an Element From ArrayC++PythonO(nlogn + mlogm + nlogk + mlogk)O(nlogk)Hardvariant ofMaximum XOR of Two Numbers in an ArrayGreedy, Trie
1720Decode XORed ArrayC++PythonO(n)O(1)Easy
1734Decode XORed PermutationC++PythonO(n)O(1)Medium
1829Maximum XOR for Each QueryC++PythonO(n)O(1)Medium
2151Maximum Good People Based on StatementsC++PythonO(n^2 * 2^n)O(1)HardBitmasks, Brute Force
2212Maximum Points in an Archery CompetitionC++PythonO(n * 2^n)O(n)MediumBitmasks, Brute Force
2220Minimum Bit Flips to Convert NumberC++PythonO(logn)O(1)EasyBit Manipulation
2275Largest Combination With Bitwise AND Greater Than ZeroC++PythonO(nlogr)O(logr)MediumBit Manipulation, Freq Table
2317Maximum XOR After OperationsC++PythonO(n)O(1)MediumBit Manipulation, Greedy
2397Maximum Rows Covered by ColumnsC++PythonO(m * n + m * C(n, k))O(m)MediumBitmasks,Hakmem Item 175
2411Smallest Subarrays With Maximum Bitwise ORC++PythonO(n)O(1)MediumBitmasks, Hash Table
2419Longest Subarray With Maximum Bitwise ANDC++PythonO(n)O(1)MediumBit Manipulation
2425Bitwise XOR of All PairingsC++PythonO(n)O(1)MediumBit Manipulation
2429Minimize XORC++PythonO(logn)O(1)MediumBit Manipulation, Greedy
2505Bitwise OR of All Subsequence SumsC++PythonO(n)O(1)Medium🔒Bit Manipulation
2527Find Xor-Beauty of ArrayC++PythonO(n)O(1)MediumBit Manipulation, Math


Array

#TitleSolutionTimeSpaceDifficultyTagNote
1002Find Common CharactersC++PythonO(n * l)O(1)Easy
1007Minimum Domino Rotations For Equal RowC++PythonO(n)O(1)Medium
1010Pairs of Songs With Total Durations Divisible by 60C++PythonO(n)O(1)Easy
1013Partition Array Into Three Parts With Equal SumC++PythonO(n)O(1)Easy
1014Best Sightseeing PairC++PythonO(n)O(1)Medium
1018Binary Prefix Divisible By 5C++PythonO(n)O(1)Easy
1030Matrix Cells in Distance OrderC++PythonO(m * n)O(1)Easy
1031Maximum Sum of Two Non-Overlapping SubarraysC++PythonO(n)O(1)Medium
1051Height CheckerC++PythonO(nlogn)O(n)Easy
1052Grumpy Bookstore OwnerC++PythonO(n)O(1)Medium
1072Flip Columns For Maximum Number of Equal RowsC++PythonO(m * n)O(m * n)Medium
1074Number of Submatrices That Sum to TargetC++PythonO(m^2 * n)O(n)Hard
1085Sum of Digits in the Minimum NumberC++PythonO(n * l)O(l)Easy🔒
1089Duplicate ZerosC++PythonO(n)O(1)Easy
1093Statistics from a Large SampleC++PythonO(n)O(1)Medium
1099Two Sum Less Than KC++PythonO(nlogn)O(1)Easy🔒
1109Corporate Flight BookingsC++PythonO(n)O(1)MediumLine Sweep
1144Decrease Elements To Make Array ZigzagC++PythonO(n)O(1)Medium
1184Distance Between Bus StopsC++PythonO(n)O(1)Easy
1200Minimum Absolute DifferenceC++PythonO(nlogn)O(n)Easy
1222Queens That Can Attack the KingC++PythonO(1)O(1)Medium
1252Cells with Odd Values in a MatrixC++PythonO(n + m)O(n + m)Easy
1260Shift 2D GridC++PythonO(n)O(1)Easy
1267Count Servers that CommunicateC++PythonO(m * n)O(m + n)Medium
1275Find Winner on a Tic Tac Toe GameC++PythonO(1)O(1)Easy
1295Find Numbers with Even Number of DigitsC++PythonO(nlog(logm))O(logm)Easy
1299Replace Elements with Greatest Element on Right SideC++PythonO(n)O(1)Easy
1304Find N Unique Integers Sum up to ZeroC++PythonO(n)O(1)Easy
1313Decompress Run-Length Encoded ListC++PythonO(n)O(1)Easy
1329Sort the Matrix DiagonallyC++PythonO(m * n * log(min(m, n))O(m * n)MediumSort
1331Rank Transform of an ArrayC++PythonO(nlogn)O(n)Easy
1333Filter Restaurants by Vegan-Friendly, Price and DistanceC++PythonO(rlogr)O(r)MediumSort
1337The K Weakest Rows in a MatrixC++PythonO(m * n)O(k)EasyOrderedDict, Quick Select
1343Number of Sub-arrays of Size K and Average Greater than or Equal to ThresholdC++PythonO(n)O(1)Medium
1346Check If N and Its Double ExistC++PythonO(n)O(n)Easy
1351Count Negative Numbers in a Sorted MatrixC++PythonO(m + n)O(1)Easy
1375Bulb Switcher IIIC++PythonO(n)O(1)Medium
1380Lucky Numbers in a MatrixC++PythonO(m * n)O(m + n)Easy
1389Create Target Array in the Given OrderC++PythonO(n^2)O(1)Easy
1394Find Lucky Integer in an ArrayC++PythonO(n)O(n)Easy
1399Count Largest GroupC++PythonO(nlogn)O(n)Easy
1404Number of Steps to Reduce a Number in Binary Representation to OneC++PythonO(n)O(1)Medium
1413Minimum Value to Get Positive Step by Step SumC++PythonO(n)O(1)Easy
1426Counting ElementsC++PythonO(n)O(n)Easy🔒
1427Perform String ShiftsC++PythonO(n + l)O(1)Easy🔒
1428Leftmost Column with at Least a OneC++PythonO(m + n)O(1)Medium🔒
1431Kids With the Greatest Number of CandiesC++PythonO(n)O(1)Easy
1437Check If All 1's Are at Least Length K Places AwayC++PythonO(n)O(1)Medium
1450Number of Students Doing Homework at a Given TimeC++PythonO(n)O(1)Easy
1460Make Two Arrays Equal by Reversing Sub-arraysC++PythonO(n)O(n)Easy
1464Maximum Product of Two Elements in an ArrayC++PythonO(n)O(1)Easy
1465Maximum Area of a Piece of Cake After Horizontal and Vertical CutsC++PythonO(hlogh + wlogw)O(1)Medium
1470Shuffle the ArrayC++PythonO(n)O(1)EasyInplace
1471The k Strongest Values in an ArrayC++PythonO(n)O(1)MediumQuick Select
1475Final Prices With a Special Discount in a ShopC++PythonO(n)O(n)EasyMono Stack
1480Running Sum of 1d ArrayC++PythonO(n)O(1)Easy
1491Average Salary Excluding the Minimum and Maximum SalaryC++PythonO(n)O(1)Easy
1502Can Make Arithmetic Progression From SequenceC++PythonO(n)O(1)Easy
1503Last Moment Before All Ants Fall Out of a PlankC++PythonO(n)O(1)Medium
1534Count Good TripletsC++PythonO(n^3)O(1)Easy
1535Find the Winner of an Array GameC++PythonO(n)O(1)Medium
1538Guess the Majority in a Hidden ArrayC++PythonO(n)O(1)Medium🔒
1550Three Consecutive OddsC++PythonO(n)O(1)Easy
1559Detect Cycles in 2D GridC++PythonO(m * n)O(m * n)HardUnion Find, BFS
1560Most Visited Sector in a Circular TrackC++PythonO(n)O(1)Easy
1562Find Latest Group of Size MC++PythonO(n)O(n)Medium
1566Detect Pattern of Length M Repeated K or More TimesC++PythonO(n)O(1)Easy
1572Matrix Diagonal SumC++PythonO(n)O(1)Easy
1574Shortest Subarray to be Removed to Make Array SortedC++PythonO(n)O(1)Medium
1582Special Positions in a Binary MatrixC++PythonO(n^2)O(n)Easy
1583Count Unhappy FriendsC++PythonO(n^2)O(n^2)Medium
1619Mean of Array After Removing Some ElementsC++PythonO(n)O(1)EasyQuick Select
1629Slowest KeyC++PythonO(n)O(1)Easy
1646Get Maximum in Generated ArrayC++PythonO(n)O(n)Easy
1652Defuse the BombC++PythonO(n)O(1)Easy
1672Richest Customer WealthC++PythonO(m * n)O(1)Easy
1700Number of Students Unable to Eat LunchC++PythonO(n)O(1)Easy
1701Average Waiting TimeC++PythonO(n)O(1)Medium
1706Where Will the Ball FallC++PythonO(m * n)O(1)Medium
1714Sum Of Special Evenly-Spaced Elements In ArrayC++PythonO(n * sqrt(n))O(n * sqrt(n))Hard🔒
1726Tuple with Same ProductC++PythonO(n^2)O(n^2)Medium
1732Find the Highest AltitudeC++PythonO(n)O(1)Medium
1738Find Kth Largest XOR Coordinate ValueC++PythonO(m * n) on averageO(m * n)MediumQuick Select
1742Maximum Number of Balls in a BoxC++PythonO(nlogm)O(logm)Easy
1752Check if Array Is Sorted and RotatedC++PythonO(n)O(1)Easy
1755Closest Subsequence SumC++PythonO(n * 2^(n/2))O(2^(n/2))HardMeet in the Middle
1773Count Items Matching a RuleC++PythonO(n)O(1)Easy
1779Find Nearest Point That Has the Same X or Y CoordinateC++PythonO(n)O(1)Easy
1800Maximum Ascending Subarray SumC++PythonO(n)O(1)Easy
1826Faulty SensorC++PythonO(n)O(1)Easy🔒
1848Minimum Distance to the Target ElementC++PythonO(n)O(1)Easy
1861Rotating the BoxC++PythonO(m * n)O(1)Medium
1869Longer Contiguous Segments of Ones than ZerosC++PythonO(n)O(1)Easy
1878Get Biggest Three Rhombus Sums in a GridC++PythonO(m * n * min(m, n))O(m * n)Easy
1886Determine Whether Matrix Can Be Obtained By RotationC++PythonO(m * n)O(1)Easy
1895Largest Magic SquareC++PythonO(max(m, n) * min(m, n)^3)O(m * n)Medium
1906Minimum Absolute Difference QueriesC++PythonO(r * (n + q))O(r * n)MediumPrefix Sum, Binary Search
1909Remove One Element to Make the Array Strictly IncreasingC++PythonO(n)O(1)Easy
1914Cyclically Rotating a GridC++PythonO(m * n)O(1)MediumInplace
1920Build Array from PermutationC++PythonO(n)O(1)EasyInplace
1929Concatenation of ArrayC++PythonO(n)O(1)Easy
1940Longest Common Subsequence Between Sorted ArraysC++PythonO(m * n)O(l)Medium🔒
1958Check if Move is LegalC++PythonO(1)O(1)Medium
1966Binary Searchable Numbers in an Unsorted ArrayC++PythonO(n)O(n)Medium🔒Prefix Sum
1970Last Day Where You Can Still CrossC++PythonO(m * n)O(m * n)Hardvariant ofBricks Falling When HitUnion Find
1983Widest Pair of Indices With Equal Range SumC++PythonO(n)O(n)Mediumvariant ofFind the Longest Substring Containing Vowels in Even Counts, 🔒Prefix Sum
1991Find the Middle Index in ArrayC++PythonO(n)O(1)EasyPrefix Sum
1992Find All Groups of FarmlandC++PythonO(m * n)O(1)Mediumvariant ofNumber of Islands
1998GCD Sort of an ArrayC++PythonO(nlogn + m)O(n + m)HardUnion Find,Sieve of Eratosthenes
2007Find Original Array From Doubled ArrayC++PythonO(n + klogk)O(k)Mediumvariant ofArray of Doubled Pairs
2011Final Value of Variable After Performing OperationsC++PythonO(n)O(1)Easy
2012Sum of Beauty in the ArrayC++PythonO(n)O(n)MediumPrefix Sum
2016Maximum Difference Between Increasing ElementsC++PythonO(n)O(1)Easyvariant ofBest Time to Buy and Sell Stock
2017Grid GameC++PythonO(n)O(1)MediumPrefix Sum
2018Check if Word Can Be Placed In CrosswordC++PythonO(m * n)O(1)Medium
2022Convert 1D Array Into 2D ArrayC++PythonO(m * n)O(1)Easy
2033Minimum Operations to Make a Uni-Value GridC++PythonO(m * n) on averageO(m * n)Mediumvariant ofMinimum Moves to Equal Array Elements IIMath, Median, Quick Select
2035Partition Array Into Two Arrays to Minimize Sum DifferenceC++PythonO(n * 2^n)O(2^n)HardMeet in the Middle
2038Remove Colored Pieces if Both Neighbors are the Same ColorC++PythonO(n)O(1)Medium
2055Plates Between CandlesC++PythonO(n + q)O(n)MediumPrefix Sum
2057Smallest Index With Equal ValueC++PythonO(n)O(1)Easy
2075Decode the Slanted CiphertextC++PythonO(n)O(1)Medium
2078Two Furthest Houses With Different ColorsC++PythonO(n)O(1)Easy
2079Watering PlantsC++PythonO(n)O(1)Medium
2098Subsequence of Size K With the Largest Even SumC++PythonO(n) on averageO(1)Medium🔒Quick Select
2099Find Subsequence of Length K With the Largest SumC++PythonO(n) on averageO(n)EasyQuick Select
2100Find Good Days to Rob the BankC++PythonO(n)O(n)MediumPrefix Sum
2106Maximum Fruits Harvested After at Most K StepsC++PythonO(n)O(n)HardPrefix Sum
2113Elements in Array After Removing and Replacing ElementsC++PythonO(n)O(1)Medium🔒
2121Intervals Between Identical ElementsC++PythonO(n)O(n)MediumPrefix Sum
2122Recover the Original ArrayC++PythonO(n^2)O(n)Hard
2128Remove All Ones With Row and Column FlipsC++PythonO(m * n)O(1)Medium🔒
2132Stamping the GridC++PythonO(m * n)O(m * n)HardPrefix Sum
2155All Divisions With the Highest Score of a Binary ArrayC++PythonO(n)O(1)MediumPrefix Sum
2194Cells in a Range on an Excel SheetC++PythonO(26^2)O(1)Easy
2202Maximize the Topmost Element After K MovesC++PythonO(min(n, k))O(1)MediumConstructive Algorithms
2210Count Hills and Valleys in an ArrayC++PythonO(n)O(1)EasySimulation
2219Maximum Sum Score of ArrayC++PythonO(n)O(1)Medium🔒Prefix Sum
2237Count Positions on Street With Required BrightnessC++PythonO(n + l)O(min(n, l))Medium🔒Line Sweep
2239Find Closest Number to ZeroC++PythonO(n)O(1)EasyArray
2245Maximum Trailing Zeros in a Cornered PathC++PythonO(m * n)O(m * n)MediumPrefix Sum
2256Minimum Average DifferenceC++PythonO(n)O(1)MediumPrefix Sum
2270Number of Ways to Split ArrayC++PythonO(n)O(1)MediumPrefix Sum
2271Maximum White Tiles Covered by a CarpetC++PythonO(nlogn)O(1)MediumSliding Window, Prefix Sum, Binary Search
2274Maximum Consecutive Floors Without Special FloorsC++PythonO(nlogn)O(1)MediumSort
2293Min Max GameC++PythonO(n)O(1)MediumSimulation
2319Check if Matrix Is X-MatrixC++PythonO(n^2)O(1)EasyArray
2326Spiral Matrix IVC++PythonO(m * n)O(1)MediumLinked List, Array
2373Largest Local Values in a MatrixC++PythonO(n^2)O(1)EasyArray
2382Maximum Segment Sum After RemovalsC++PythonO(n)O(n)HardPrefix Sum, Sorted List, BST, Union Find
2391Minimum Amount of Time to Collect GarbageC++PythonO(n * l)O(1)MediumPrefix Sum, Simulation
2406Divide Intervals Into Minimum Number of GroupsC++PythonO(nlogn)O(n)MediumSort, Line Sweep
2407Longest Increasing Subsequence IIC++PythonO(nlogn)O(n)Hardvariant ofLongest Increasing SubsequenceSegment Tree, Coordinate Compression
2428Maximum Sum of an HourglassC++PythonO(m * n)O(1)MediumBrute Force
2432The Employee That Worked on the Longest TaskC++PythonO(l)O(1)EasyArray
2433Find The Original Array of Prefix XorC++PythonO(n)O(1)MediumArray
2438Range Product Queries of PowersC++PythonO(logn + qlogr)O(logn)MediumPrefix Sum
2446Determine if Two Events Have ConflictC++PythonO(1)O(1)EasyArray
2460Apply Operations to an ArrayC++PythonO(n)O(1)EasyInplace, Array
2482Difference Between Ones and Zeros in Row and ColumnC++PythonO(m * n)O(m + n)MediumArray
2500Delete Greatest Value in Each RowC++PythonO(m * nlogn)O(1)EasyArray
2515Shortest Distance to Target String in a Circular ArrayC++PythonO(n)O(1)EasyArray
2535Difference Between Element Sum and Digit Sum of an ArrayC++PythonO(nlogr)O(1)EasyArray
2536Increment Submatrices by OneC++PythonO(q + n^2)O(1)MediumLine Sweep, Difference Matrix, Difference Array
2553Separate the Digits in an ArrayC++PythonO(n * logr)O(1)EasyArray
2559Count Vowel Strings in RangesC++PythonO(n + q)O(n)MediumPrefix Sum
2569Handling Sum Queries After UpdateC++PythonO(nlogn + m + qlogn)O(n)HardSegment Tree


String

#TitleSolutionTimeSpaceDifficultyTagNote
1016Binary String With Substrings Representing 1 To NC++PythonO(n^2)O(1)Medium
1023Camelcase MatchingC++PythonO(n * l)O(1)Medium
1061Lexicographically Smallest Equivalent StringC++PythonO(n)O(n)Medium🔒Union Find
1056Confusing NumberC++PythonO(logn)O(logn)Easy🔒
1071Greatest Common Divisor of StringsC++PythonO(m + n)O(1)Easy
1078Occurrences After BigramC++PythonO(n)O(1)Easy
1100Find K-Length Substrings With No Repeated CharactersC++PythonO(n)O(k)Medium🔒
1108Defanging an IP AddressC++PythonO(n)O(1)Easy
1119Remove Vowels from a StringC++PythonO(n)O(1)Easy🔒
1147Longest Chunked Palindrome DecompositionC++PythonO(n)O(1)HardRabin-Karp Algorithm
1177Can Make Palindrome from SubstringC++PythonO(m + n)O(n)Medium
1178Number of Valid Words for Each PuzzleC++PythonO(n * l + m * L)O(L!)HardTrie, Bit Manipulation
1189Maximum Number of BalloonsC++PythonO(n)O(1)EasyHash
1233Remove Sub-Folders from the FilesystemC++PythonO(n)O(t)MediumTrie
1271HexspeakC++PythonO(n)O(1)Easy
1309Decrypt String from Alphabet to Integer MappingC++PythonO(n)O(1)Easy
1324Print Words VerticallyC++PythonO(n)O(n)Medium
1328Break a PalindromeC++PythonO(n)O(1)Medium
1332Remove Palindromic SubsequencesC++PythonO(n)O(1)Easy
1347Minimum Number of Steps to Make Two Strings AnagramC++PythonO(n)O(1)Medium
1370Increasing Decreasing StringC++PythonO(n)O(1)EasySort
1371Find the Longest Substring Containing Vowels in Even CountsC++PythonO(n)O(1)Medium
1374Generate a String With Characters That Have Odd CountC++PythonO(n)O(1)Easy
1392Longest Happy PrefixC++PythonO(n)O(n)HardKMP Algorithm,Rabin-Karp Algorithm
1408String Matching in an ArrayC++PythonO(n)O(t)EasyKMP Algorithm,Aho-Corasick Automata, Trie
1410HTML Entity ParserC++PythonO(n)O(t)MediumAho-Corasick Automata, Trie
1417Reformat The StringC++PythonO(n)O(1)Easy
1422Maximum Score After Splitting a StringC++PythonO(n)O(1)Easy
1432Max Difference You Can Get From Changing an IntegerC++PythonO(logn)O(logn)Medium
1436Destination CityC++PythonO(n)O(n)Easy
1446Consecutive CharactersC++PythonO(n)O(1)Easy
1455Check If a Word Occurs As a Prefix of Any Word in a SentenceC++PythonO(n)O(n)EasyKMP Algorithm
1461Check If a String Contains All Binary Codes of Size KC++PythonO(n * k)O(k * 2^k)MediumBit Manipulation
1496Path CrossingC++PythonO(n)O(n)Easy
1507Reformat DateC++PythonO(n)O(1)Easy
1528Shuffle StringC++PythonO(n)O(1)Easy
1529Bulb Switcher IVC++PythonO(n)O(1)Medium
1540Can Convert String in K MovesC++PythonO(n)O(1)Medium
1542Find Longest Awesome SubstringC++PythonO(n)O(1)Hard
1544Make The String GreatC++PythonO(n)O(1)Easy
1545Find Kth Bit in Nth Binary StringC++PythonO(n)O(1)Medium
1554Strings Differ by One CharacterC++PythonO(n * m)O(n)MediumRabin-Karp Algorithm
1556Thousand SeparatorC++PythonO(n)O(1)Easy
1573Number of Ways to Split a StringC++PythonO(n)O(1)Medium
1576Replace All ?'s to Avoid Consecutive Repeating CharactersC++PythonO(n)O(1)Easy
1592Rearrange Spaces Between WordsC++PythonO(n)O(1)EasyInplace
1598Crawler Log FolderC++PythonO(n)O(1)Easy
1614Maximum Nesting Depth of the ParenthesesC++PythonO(n)O(1)Easy
1624Largest Substring Between Two Equal CharactersC++PythonO(n)O(1)Easy
1638Count Substrings That Differ by One CharacterC++PythonO(m * n)O(1)Mediumvariant ofCount Unique Characters of All Substrings of a Given StringTricky
1662Check If Two String Arrays are EquivalentC++PythonO(n)O(1)Easy
1668Maximum Repeating SubstringC++PythonO(n)O(m)EasyKMP Algorithm
1678Goal Parser InterpretationC++PythonO(n)O(1)Easy
1684Count the Number of Consistent StringsC++PythonO(n)O(1)Easy
1694Reformat Phone NumberC++PythonO(n)O(1)EasyInplace
1698Number of Distinct Substrings in a StringC++PythonO(n^2)O(t)Medium🔒Trie
1704Determine if String Halves Are AlikeC++PythonO(n)O(1)Easy
1763Longest Nice SubstringC++PythonO(n)O(n)Easy
1768Merge Strings AlternatelyC++PythonO(m + n)O(1)Easy
1784Check if Binary String Has at Most One Segment of OnesC++PythonO(n)O(1)Easy
1790Check if One String Swap Can Make Strings EqualC++PythonO(n)O(1)Easy
1796Second Largest Digit in a StringC++PythonO(n)O(1)Easy
1805Number of Different Integers in a StringC++PythonO(n)O(n)Easy
1813Sentence Similarity IIIC++PythonO(n)O(1)Medium
1816Truncate SentenceC++PythonO(n)O(1)Easy
1832Check if the Sentence Is PangramC++PythonO(n)O(1)Easy
1839Longest Substring Of All Vowels in OrderC++PythonO(n)O(1)Medium
1844Replace All Digits with CharactersC++PythonO(n)O(1)Easy
1854Maximum Population YearC++PythonO(n)O(1)EasyLine Sweep
1858Longest Word With All PrefixesC++PythonO(n)O(t)Medium🔒Trie, DFS
1876Substrings of Size Three with Distinct CharactersC++PythonO(n)O(1)Easy
1880Check if Word Equals Summation of Two WordsC++PythonO(n)O(1)Easy
1903Largest Odd Number in StringC++PythonO(n)O(1)Easy
1910Remove All Occurrences of a SubstringC++PythonO(n + m)O(n + m)MediumKMP Algorithm
1933Check if String Is Decomposable Into Value-Equal SubstringsC++PythonO(n)O(1)Easy🔒
1935Maximum Number of Words You Can TypeC++PythonO(n)O(1)Easy
1957Delete Characters to Make Fancy StringC++PythonO(n)O(1)EasyInplace
1961Check If String Is a Prefix of ArrayC++PythonO(n)O(1)Easy
1963Minimum Number of Swaps to Make the String BalancedC++PythonO(n)O(1)Mediumvariant ofMaximum Nesting Depth of the Parentheses
1967Number of Strings That Appear as Substrings in WordC++PythonO(n * l + m)O(t)EasyKMP Algorithm,Aho-Corasick Automata, Trie
1974Minimum Time to Type Word Using Special TypewriterC++PythonO(n)O(1)Easy
2000Reverse Prefix of WordC++PythonO(n)O(1)Easy
2042Check if Numbers Are Ascending in a SentenceC++PythonO(n)O(1)Easy
2047Number of Valid Words in a SentenceC++PythonO(n)O(1)Easy
2048Next Greater Numerically Balanced NumberC++PythonO(1)O(1)MediumPermutations, Precompute, Binary Search
2081Sum of k-Mirror NumbersC++PythonO(10^6)O(1)HardString, Palindrome, Brute Force
2103Rings and RodsC++PythonO(n)O(1)Easy
2108Find First Palindromic String in the ArrayC++PythonO(n)O(1)Easy
2109Adding Spaces to a StringC++PythonO(n)O(1)MediumInplace
2114Maximum Number of Words Found in SentencesC++PythonO(n)O(1)Easy
2116Check if a Parentheses String Can Be ValidC++PythonO(n)O(1)Medium
2124Check if All A's Appears Before All B'sC++PythonO(n)O(1)Easy
2129Capitalize the TitleC++PythonO(n)O(1)Easy
2131Longest Palindrome by Concatenating Two Letter WordsC++PythonO(n)O(n)Medium
2135Count Words Obtained After Adding a LetterC++PythonO(n)O(n)MediumBitmasks
2138Divide a String Into Groups of Size kC++PythonO(n)O(1)Easy
2156Find Substring With Given Hash ValueC++PythonO(n)O(1)MediumRabin-Karp Algorithm, Rolling Hash
2157Groups of StringsC++PythonO(26 * n)O(26 * n)HardBitmasks, Union Find
2168Unique Substrings With Equal Digit FrequencyC++PythonO(n^2)O(n^2)Medium🔒Rabin-Karp Algorithm, Rolling Hash
2185Counting Words With a Given PrefixC++PythonO(n * p)O(1)Easy
2186Minimum Number of Steps to Make Two Strings Anagram IIC++PythonO(n)O(1)Mediumvariant ofMinimum Number of Steps to Make Two Strings Anagram
2211Count Collisions on a RoadC++PythonO(n)O(1)MediumCounting, Simulation
2213Longest Substring of One Repeating CharacterC++PythonO(nlogn)O(n)HardSegment Tree
2223Sum of Scores of Built StringsC++PythonO(n)O(n)HardZ-Function
2232Minimize Result by Adding Parentheses to ExpressionC++PythonO(n^2)O(1)MediumBrute Force
2243Calculate Digit Sum of a StringC++PythonO(n)O(n)EasySimulation
2255Count Prefixes of a Given StringC++PythonO(n * l)O(1)EasyString
2264Largest 3-Same-Digit Number in StringC++PythonO(n)O(1)EasyString
2269Find the K-Beauty of a NumberC++PythonO(logn)O(logn)EasySliding Window
2272Substring With Largest VarianceC++PythonO(a^2 * n)O(a)HardKadane's Algorithm
2273Find Resultant Array After Removing AnagramsC++PythonO(n * l)O(1)EasyFreq Table, Sort
2278Percentage of Letter in StringC++PythonO(n)O(1)EasyString
2288Apply Discount to PricesC++PythonO(n)O(1)MediumString
2299Strong Password Checker IIC++PythonO(n)O(1)EasyString
2301Match Substring After ReplacementC++PythonO(n * k)O(m)HardBrute Force
2315Count AsterisksC++PythonO(n)O(1)EasyString
2381Shifting Letters IIC++PythonO(n)O(n)MediumLine Sweep
2390Removing Stars From a StringC++PythonO(n)O(n)MediumString, Stack
2414Length of the Longest Alphabetical Continuous SubstringC++PythonO(n)O(1)MediumString
2416Sum of Prefix Scores of StringsC++PythonO(n * l)O(t)HardTrie
2490Circular SentenceC++PythonO(n)O(1)EasyString
2496Maximum Value of a String in an ArrayC++PythonO(n * l)O(1)EasyString
2546Apply Bitwise Operations to Make Strings EqualC++PythonO(n)O(1)MediumConstructive Algorithms


Linked List

#TitleSolutionTimeSpaceDifficultyTagNote
1171Remove Zero Sum Consecutive Nodes from Linked ListC++PythonO(n)O(n)MediumOrderedDict, Hash
1180Count Substrings with Only One Distinct LetterC++PythonO(n)O(1)Easy🔒
1181Before and After PuzzleC++PythonO(l * rlogr)O(l * (n + r))Medium🔒Hash
1265Print Immutable Linked List in ReverseC++PythonO(n)O(sqrt(n))Medium🔒
1290Convert Binary Number in a Linked List to IntegerC++PythonO(n)O(1)Easy
1474Delete N Nodes After M Nodes of a Linked ListC++PythonO(n)O(1)Easy🔒
1634Add Two Polynomials Represented as Linked ListsC++PythonO(m + n)O(1)Medium🔒
1650Lowest Common Ancestor of a Binary Tree IIIC++PythonO(h)O(1)Medium🔒, variant ofIntersection of Two Linked Lists
1669Merge In Between Linked ListsC++PythonO(m + n)O(1)Medium
1721Swapping Nodes in a Linked ListC++PythonO(n)O(1)Medium
1836Remove Duplicates From an Unsorted Linked ListC++PythonO(n)O(n)Medium🔒
2058Find the Minimum and Maximum Number of Nodes Between Critical PointsC++PythonO(n)O(1)Medium
2074Reverse Nodes in Even Length GroupsC++PythonO(n)O(1)Medium
2095Delete the Middle Node of a Linked ListC++PythonO(n)O(1)MediumTwo Pointers
2130Maximum Twin Sum of a Linked ListC++PythonO(n)O(1)MediumTwo Pointers
2181Merge Nodes in Between ZerosC++PythonO(n)O(1)MediumTwo Pointers
2487Remove Nodes From Linked ListC++PythonO(n)O(n)MediumMono Stack


Stack

#TitleSolutionTimeSpaceDifficultyTagNote
1003Check If Word Is Valid After SubstitutionsC++PythonO(n)O(n)Medium
1019Next Greater Node In Linked ListC++PythonO(n)O(n)MediumMono Stack
1021Remove Outermost ParenthesesC++PythonO(n)O(1)Easy
1047Remove All Adjacent Duplicates In StringC++PythonO(n)O(n)Easy
1063Number of Valid SubarraysC++PythonO(n)O(n)Hard🔒Mono Stack
1130Minimum Cost Tree From Leaf ValuesC++PythonO(n)O(n)MediumMono Stack
1190Reverse Substrings Between Each Pair of ParenthesesC++PythonO(n)O(n)Medium
1209Remove All Adjacent Duplicates in String IIC++PythonO(n)O(n)Medium
1441Build an Array With Stack OperationsC++PythonO(n)O(1)Easy
1541Minimum Insertions to Balance a Parentheses StringC++PythonO(n)O(1)Medium
1597Build Binary Expression Tree From Infix ExpressionC++PythonO(n)O(n)Medium🔒, variant ofBasic Calculator III
1856Maximum Subarray Min-ProductC++PythonO(n)O(n)Mediumvariant ofLargest Rectangle in HistogramMono Stack, Prefix Sum
1944Number of Visible People in a QueueC++PythonO(n)O(n)Hardvariant ofBuildings With an Ocean ViewMono Stack
1950Maximum of Minimum Values in All SubarraysC++PythonO(n)O(n)Medium🔒Mono Stack
2104Sum of Subarray RangesC++PythonO(n)O(n)MediumMono Stack
2197Replace Non-Coprime Numbers in ArrayC++PythonO(nlogm)O(1)HardStack, Math
2281Sum of Total Strength of WizardsC++PythonO(n)O(n)Hardvariant ofLargest Rectangle in HistogramMono Stack, Prefix Sum
2282Number of People That Can Be Seen in a GridC++PythonO(m * n)O(m + n)Medium🔒, variant ofNumber of Visible People in a QueueMono Stack
2334Subarray With Elements Greater Than Varying ThresholdC++PythonO(n)O(n)Hardvariant ofMaximum Subarray Min-ProductMono Stack
2355Maximum Number of Books You Can TakeC++PythonO(n)O(n)Hard🔒Mono Stack, Math
2454Next Greater Element IVC++PythonO(n)O(n)HardMono Stack


Queue

#TitleSolutionTimeSpaceDifficultyTagNote
1424Diagonal Traverse IIC++PythonO(m * n)O(m)Medium
1438Longest Continuous Subarray With Absolute Diff Less Than or Equal to LimitC++PythonO(n)O(n)HardMono Deque
1499Max Value of EquationC++PythonO(n)O(n)HardMono Deque
1696Jump Game VIC++PythonO(n)O(k)MediumMono Deque, Sliding Window
2398Maximum Number of Robots Within BudgetC++PythonO(n)O(n)HardMono Deque, Sliding Window, Two Pointers


Binary Heap

#TitleSolutionTimeSpaceDifficultyTagNote
1046Last Stone WeightC++PythonO(nlogn)O(n)Easy
1057Campus BikesC++PythonO((w * b) * log(w * b))O(w * b)Medium🔒
1439Find the Kth Smallest Sum of a Matrix With Sorted RowsC++PythonO(m * klogk)O(k)HardBinary Search
1606Find Servers That Handled Most Number of RequestsC++PythonO(nlogk)O(k)HardSorted List
1642Furthest Building You Can ReachC++PythonO(nlogk)O(k)Medium
1675Minimize Deviation in ArrayC++PythonO((n * log(max_num)) * logn)O(n)Hard
1792Maximum Average Pass RatioC++PythonO(n + mlogn)O(n)Medium
1882Process Tasks Using ServersC++PythonO(n + mlogn)O(n)Medium
1962Remove Stones to Minimize the TotalC++PythonO(n + klogn)O(1)Medium
2054Two Best Non-Overlapping EventsC++PythonO(nlogn)O(n)MediumLine Sweep, Heap
2163Minimum Difference in Sums After Removal of ElementsC++PythonO(nlogn)O(n)HardHeap, Prefix Sum
2208Minimum Operations to Halve Array SumC++PythonO(nlogn)O(n)MediumHeap
2386Find the K-Sum of an ArrayC++PythonO(nlogn + klogk)O(n + k)HardBFS, Heap
2402Meeting Rooms IIIC++PythonO(mlogm + n + mlogn)O(n)HardHeap
2462Total Cost to Hire K WorkersC++PythonO(c + klogc)O(c)MediumHeap, Two Pointers
2519Count the Number of K-Big IndicesC++PythonO(nlogk)O(n)Hard🔒Heap, Ordered Set, Sorted List
2530Maximal Score After Applying K OperationsC++PythonO(n + klogn)O(1)MediumHeap, Simulation
2558Take Gifts From the Richest PileC++PythonO(n + klogn)O(1)EasyHeap, Simulation


Tree

#TitleSolutionTimeSpaceDifficultyTagNote
1008Construct Binary Search Tree from Preorder TraversalC++PythonO(n)O(h)Medium
1022Sum of Root To Leaf Binary NumbersC++PythonO(n)O(h)Easy
1026Maximum Difference Between Node and AncestorC++PythonO(n)O(h)MediumDFS
1028Recover a Tree From Preorder TraversalC++PythonO(n)O(h)HardDFS
1032Stream of CharactersC++C++PythonPythonctor:O(n)
query:O(m)
O(t)HardAho-Corasick Automata, Trie
1038Binary Search Tree to Greater Sum TreeC++PythonO(n)O(h)MediumDFS
1065Index Pairs of a StringC++PythonO(n + m + z)O(t)Easy🔒Aho-Corasick Automata, Trie
1080Insufficient Nodes in Root to Leaf PathsC++PythonO(n)O(h)MediumDFS
1104Path In Zigzag Labelled Binary TreeC++PythonO(logn)O(logn)EasyMath
1120Maximum Average SubtreeC++PythonO(n)O(h)Easy🔒DFS
1123Lowest Common Ancestor of Deepest LeavesC++PythonO(n)O(h)MediumDFS
1145Binary Tree Coloring GameC++PythonO(n)O(h)MediumDFS
1257Smallest Common RegionC++PythonO(m * n)O(n)Medium
1261Find Elements in a Contaminated Binary TreeC++PythonO(n)O(h)MediumDFS
1325Delete Leaves With a Given ValueC++PythonO(n)O(h)MediumDFS
1339Maximum Product of Splitted Binary TreeC++PythonO(n)O(h)MediumDFS
1409Queries on a Permutation With KeyC++PythonO(nlogn)O(n)MediumBIT, Fenwick Tree
1430Check If a String Is a Valid Sequence from Root to Leaves Path in a Binary TreeC++PythonO(n)O(h)Medium🔒BFS, DFS, Stack
1443Minimum Time to Collect All Apples in a TreeC++PythonO(n)O(n)MediumDFS, Stack
1448Count Good Nodes in Binary TreeC++PythonO(n)O(h)MediumDFS, Stack
1457Pseudo-Palindromic Paths in a Binary TreeC++PythonO(n)O(h)MediumDFS, Stack
1469Find All The Lonely NodesC++PythonO(n)O(h)Easy🔒DFS, Stack
1490Clone N-ary TreeC++PythonO(n)O(h)Medium🔒DFS, Stack
1505Minimum Possible Integer After at Most K Adjacent Swaps On DigitsC++PythonO(nlogn)O(n)HardBIT, Fenwick Tree
1506Find Root of N-Ary TreeC++PythonO(n)O(1)Medium🔒Bit Manipulation
1516Move Sub-Tree of N-Ary TreeC++PythonO(n)O(h)Hard🔒DFS, Stack
1519Number of Nodes in the Sub-Tree With the Same LabelC++PythonO(n)O(h)MediumDFS, Stack
1522Diameter of N-Ary TreeC++PythonO(n)O(h)Medium🔒DFS, Stack
1530Number of Good Leaf Nodes PairsC++PythonO(n)O(h)MediumDFS, Stack
1612Check If Two Expression Trees are EquivalentC++PythonO(n)O(1)Medium🔒Morris Traversal, Inorder Traversal, Stack, Hash Table
1649Create Sorted Array through InstructionsC++PythonO(nlogn)O(n)Hardvariant ofCount of Smaller Numbers After SelfBIT, Fenwick Tree, Merge Sort
1666Change the Root of a Binary TreeC++PythonO(h)O(1)Medium🔒
1834Single-Threaded CPUC++PythonO(nlogn)O(n)Medium
1938Maximum Genetic Difference QueryC++PythonO(nlogk + mlogk)O(n + logk)Hardvariant ofMaximum XOR With an Element From ArrayDFS, Greedy, Trie
1948Delete Duplicate Folders in SystemC++PythonO(n * m * l + tlogt + l * t)O(l * t)Hardvariant ofFind Duplicate SubtreesTrie, DFS, Hash
2003Smallest Missing Genetic Value in Each SubtreeC++PythonO(n)O(n)HardDFS, Stack
2096Step-By-Step Directions From a Binary Tree Node to AnotherC++PythonO(n)O(h)MediumDFS, Stack
2179Count Good Triplets in an ArrayC++PythonO(nlogn)O(n)Hardvariant ofCreate Sorted Array through InstructionsBIT, Fenwick Tree
2196Create Binary Tree From DescriptionsC++PythonO(n)O(n)Medium
2236Root Equals Sum of ChildrenC++PythonO(1)O(1)EasyTree
2277Closest Node to Path in TreeC++PythonO(n + q)O(n)Hard🔒Tree, BFS, Binary Lifting,Tarjan's Offline LCA Algorithm
2421Number of Good PathsC++PythonO(nlogn)O(n)HardSort, Union Find
2509Cycle Length Queries in a TreeC++PythonO(q * n)O(1)HardTree, LCA


Hash Table

#TitleSolutionTimeSpaceDifficultyTagNote
1001Grid IlluminationC++PythonO(l + q)O(l)Hard
1124Longest Well-Performing IntervalC++PythonO(n)O(n)Medium
1133Largest Unique NumberC++PythonO(n)O(n)Easy🔒Hash
1152Analyze User Website Visit PatternC++PythonO(n^3)O(n^3)Medium🔒Hash
1153String Transforms Into Another StringC++PythonO(n)O(1)Hard🔒Hash
1160Find Words That Can Be Formed by CharactersC++PythonO(m * n)O(1)Easy
1165Single-Row KeyboardC++PythonO(n)O(1)Easy🔒
1198Find Smallest Common Element in All RowsC++PythonO(m * n)O(n)Medium🔒
1207Unique Number of OccurrencesC++PythonO(n)O(n)Easy
1224Maximum Equal FrequencyC++PythonO(n)O(n)Hard
1418Display Table of Food Orders in a RestaurantC++PythonO(n + tlogt + flogf)O(n)Medium
1452People Whose List of Favorite Companies Is Not a Subset of Another ListC++PythonO(n * m * l + n^2 * m)O(n * m * l)Medium
1487Making File Names UniqueC++PythonO(n)O(n)Medium
1577Number of Ways Where Square of Number Is Equal to Product of Two NumbersC++PythonO(m * n)O(m + n)Medium
1590Make Sum Divisible by PC++PythonO(n)O(p)Mediumvariant ofSubarray Sums Divisible by K
1640Check Array Formation Through ConcatenationC++PythonO(n)O(n)Easy
1657Determine if Two Strings Are CloseC++PythonO(n)O(1)Medium
1679Max Number of K-Sum PairsC++PythonO(n)O(n)Medium
1711Count Good MealsC++PythonO(n)O(1)Medium
1748Sum of Unique ElementsC++PythonO(n)O(n)Easy
1781Sum of Beauty of All SubstringsC++PythonO(n^2)O(1)Medium
1807Evaluate the Bracket Pairs of a StringC++PythonO(n + m)O(n + m)Medium
1814Count Nice Pairs in an ArrayC++PythonO(nlogm)O(n)Medium
1817Finding the Users Active MinutesC++PythonO(n)O(n)Medium
1915Number of Wonderful SubstringsC++PythonO(n)O(1)Medium
1923Longest Common SubpathC++PythonO(m * nlogn)O(n)HardBinary Search,Rabin-Karp Algorithm
1925Count Square Sum TriplesC++PythonO(n^2)O(n)Easy
1930Unique Length-3 Palindromic SubsequencesC++PythonO(n)O(1)Medium
1941Check if All Characters Have Equal Number of OccurrencesC++PythonO(n)O(1)Easy
1995Count Special QuadrupletsC++PythonO(n^3)O(n)Easyvariant of4 Sum
2006Count Number of Pairs With Absolute Difference KC++PythonO(n)O(n)Easyvariant ofTwo Sum
2023Number of Pairs of Strings With Concatenation Equal to TargetC++PythonO(n * l)O(n)Mediumvariant ofTwo Sum
2025Maximum Number of Ways to Partition an ArrayC++PythonO(n)O(n)HardPrefix Sum
2032Two Out of ThreeC++PythonO(n)O(min(n, r))EasyCounting
2053Kth Distinct String in an ArrayC++PythonO(n)O(n)Easy
2068Check Whether Two Strings are Almost EquivalentC++PythonO(n)O(1)Easy
2085Count Common Words With One OccurrenceC++PythonO(m + n)O(m + n)Easy
2120Execution of All Suffix Instructions Staying in a GridC++PythonO(m)O(m)Medium
2150Find All Lonely Numbers in the ArrayC++PythonO(n)O(n)Medium
2154Keep Multiplying Found Values by TwoC++PythonO(n)O(n)Easy
2170Minimum Operations to Make the Array AlternatingC++PythonO(n)O(n)MediumFreq Table
2190Most Frequent Number Following Key In an ArrayC++PythonO(n)O(n)EasyFreq Table
2201Count Artifacts That Can Be ExtractedC++PythonO(a + d)O(d)MediumHash Table
2206Divide Array Into Equal PairsC++PythonO(n)O(n)EasyHash Table
2215Find the Difference of Two ArraysC++PythonO(n)O(n)EasyHash Table
2225Find Players With Zero or One LossesC++PythonO(nlogn)O(n)MediumHash Table, Sort
2229Check if an Array Is ConsecutiveC++PythonO(n)O(n)Easy🔒Hash Table, Sort
2260Minimum Consecutive Cards to Pick UpC++PythonO(n)O(n)MediumHash Table
2261K Divisible Elements SubarraysC++PythonO(n^2)O(t)MediumTrie,Rabin-Karp Algorithm
2283Check if Number Has Equal Digit Count and Digit ValueC++PythonO(n)O(1)EasyFreq Table
2284Sender With Largest Word CountC++PythonO(n * l)O(n)MediumFreq Table
2287Rearrange Characters to Make Target StringC++PythonO(n + m)O(1)EasyFreq Table
2295Replace Elements in an ArrayC++PythonO(n + m)O(n)MediumHash Table
2306Naming a CompanyC++PythonO(26 * n * l)O(n * l)HardHash Table, Math
2309Greatest English Letter in Upper and Lower CaseC++PythonO(n)O(1)EasyFreq Table, Hash Table
2325Decode the MessageC++PythonO(n + m)O(1)EasyString, Hash Table
2341Maximum Number of Pairs in ArrayC++PythonO(n)O(r)EasyFreq Table
2342Max Sum of a Pair With Equal Sum of DigitsC++PythonO(nlogr)O(n)MediumHash Table, Greedy
2347Best Poker HandC++PythonO(1)O(1)EasyFreq Table
2351First Letter to Appear TwiceC++PythonO(n)O(1)EasyString, Hash Table
2352Equal Row and Column PairsC++PythonO(n^2)O(n^2)MediumHash Table
2354Number of Excellent PairsC++PythonO(n)O(n)HardBit Manipulation, Sort, Two Pointers, Freq Table, Combinatorics
2357Make Array Zero by Subtracting Equal AmountsC++PythonO(n)O(n)EasyHash Table
2363Merge Similar ItemsC++PythonO((m + n) * log(m + n))O(m + n)EasyFreq Table, Sort
2364Count Number of Bad PairsC++PythonO(n)O(n)Mediumvariant ofCount Nice Pairs in an ArrayHash Table
2365Task Scheduler IIC++PythonO(n)O(n)MediumHash Table
2367Number of Arithmetic TripletsC++PythonO(n)O(n)EasyHash Table
2374Node With Highest Edge ScoreC++PythonO(n)O(n)MediumHash Table
2395Find Subarrays With Equal SumC++PythonO(n)O(n)EasyHash Table
2399Check Distances Between Same LettersC++PythonO(n)O(1)EasyHash Table
2404Most Frequent Even ElementC++PythonO(n)O(n)EasyFreq Table
2423Remove Letter To Equalize FrequencyC++PythonO(n)O(1)EasyBrute Force, Freq Table
2441Largest Positive Integer That Exists With Its NegativeC++PythonO(n)O(n)EasyHash Table
2442Count Number of Distinct Integers After Reverse OperationsC++PythonO(nlogr)O(n)MediumHash Table
2451Odd String DifferenceC++PythonO(m * n)O(1)EasyFreq Table
2452Words Within Two Edits of DictionaryC++PythonO(25 * l * (n + q))O(25 * l * n)Mediumvariant ofMHC2022 - Round 3Brute Force, Hash
2453Destroy Sequential TargetsC++PythonO(n)O(s)MediumFreq Table
2456Most Popular Video CreatorC++PythonO(n)O(n)MediumHash Table
2484Count Palindromic SubsequencesC++PythonO(100 * n)O(100 * n)HardFreq Table, Prefix Sum, DP
2488Count Subarrays With Median KC++PythonO(n)O(n)HardFreq Table, Prefix Sum
2489Number of Substrings With Fixed RatioC++PythonO(n)O(n)Medium🔒Freq Table, Prefix Sum
2491Divide Players Into Teams of Equal SkillC++PythonO(n)O(n)MediumFreq Table
2501Longest Square Streak in an ArrayC++PythonO(nlogn)O(n)MediumHash Table, DP
2506Count Pairs Of Similar StringsC++PythonO(n * l)O(n)EasyFreq Table, Bitmask
2531Make Number of Distinct Characters EqualC++PythonO(m + n)O(1)MediumFreq Table
2564Substring XOR QueriesC++PythonO(n * logr + q)O(min(n * logr, r))MediumHash Table


Math

#TitleSolutionTimeSpaceDifficultyTagNote
1006Clumsy FactorialC++PythonO(1)O(1)Medium
1009Complement of Base 10 IntegerC++PythonO(logn)O(1)Easy
1012Numbers With Repeated DigitsC++PythonO(logn)O(logn)Hard
1015Smallest Integer Divisible by KC++PythonO(k)O(1)Medium
1017Convert to Base -2C++PythonO(logn)O(1)Medium
1025Divisor GameC++PythonO(1)O(1)EasyDP
1037Valid BoomerangC++PythonO(1)O(1)Easy
1041Robot Bounded In CircleC++PythonO(n)O(1)Medium
1067Digit Count in RangeC++PythonO(logn)O(1)Hard🔒, variant ofNumber of Digit One
1073Adding Two Negabinary NumbersC++PythonO(n)O(n)Medium
1079Letter Tile PossibilitiesC++PythonO(n^2)O(n)MediumGenerating Function, Backtracking
1088Confusing Number IIC++PythonO(logn)O(logn)Hard🔒
1103Distribute Candies to PeopleC++PythonO(n + logc)O(1)EasyBinary Search
1118Number of Days in a MonthC++PythonO(1)O(1)Easy🔒
1121Divide Array Into Increasing SequencesC++PythonO(n)O(1)Hard🔒
1128Number of Equivalent Domino PairsC++PythonO(n)O(n)Easy
1131Maximum of Absolute Value ExpressionC++PythonO(n)O(1)Medium
1134Armstrong NumberC++PythonO(klogk)O(k)Easy🔒
1150Check If a Number Is Majority Element in a Sorted ArrayC++PythonO(nlogn)O(1)Easy🔒Binary Search
1157Online Majority Element In SubarrayC++Pythonctor:O(n)
query:O(klogn)
O(n)HardBinary Search, Segment Tree,Boyer–Moore Majority Vote Algorithm
1154Day of the YearC++PythonO(1)O(1)Easy
1175Prime ArrangementsC++PythonO(nlog(logn))O(n)EasySieve of Eratosthenes
1185Day of the WeekC++PythonO(1)O(1)EasyZeller Formula
1197Minimum Knight MovesC++PythonO(1)O(1)Medium🔒DP, Math
1217Play with ChipsC++PythonO(n)O(1)Medium
1227Airplane Seat Assignment ProbabilityC++PythonO(1)O(1)Medium
1232Check If It Is a Straight LineC++PythonO(1)O(1)Easy
1237Find Positive Integer Solution for a Given EquationC++PythonO(n)O(1)Easy
1238Circular Permutation in Binary RepresentationC++PythonO(2^n)O(1)Mediumvariant ofGray Code
1250Check If It Is a Good ArrayC++PythonO(n)O(1)HardBézout's identity
1256Encode NumberC++PythonO(logn)O(1)Medium
1259Handshakes That Don't CrossC++PythonO(n)O(1)HardCatalan Number, DP
1266Minimum Time Visiting All PointsC++PythonO(n)O(1)Easy
1276Number of Burgers with No Waste of IngredientsC++PythonO(1)O(1)Medium
1281Subtract the Product and Sum of Digits of an IntegerC++PythonO(logn)O(1)Easy
1300Sum of Mutated Array Closest to TargetC++PythonO(nlogn)O(1)MediumBinary Search
1317Convert Integer to the Sum of Two No-Zero IntegersC++PythonO(logn)O(1)Easy
1323Maximum 69 NumberC++PythonO(logn)O(1)Easy
1330Reverse Subarray To Maximize Array ValueC++PythonO(n)O(1)Hard
1344Angle Between Hands of a ClockC++PythonO(1)O(1)Medium
1359Count All Valid Pickup and Delivery OptionsC++PythonO(n)O(1)Hard
1360Number of Days Between Two DatesC++PythonO(1)O(1)Easyvariant ofDay of the Year
1362Closest DivisorsC++PythonO(sqrt(n))O(1)Medium
1363Largest Multiple of ThreeC++PythonO(n)O(1)Hard
1390Four DivisorsC++PythonO(n * sqrt(n))O(1)Medium
1401Circle and Rectangle OverlappingC++PythonO(1)O(1)Medium
1415The k-th Lexicographical String of All Happy Strings of Length nC++PythonO(n)O(1)Medium
1442Count Triplets That Can Form Two Arrays of Equal XORC++PythonO(n)O(n)Medium
1447Simplified FractionsC++PythonO(n^2 * logn)O(n^2)Medium
1486XOR Operation in an ArrayC++PythonO(1)O(1)Easy
1492The kth Factor of nC++PythonO(sqrt(n))O(1)Medium
1497Check If Array Pairs Are Divisible by kC++PythonO(n)O(k)Medium
1512Number of Good PairsC++PythonO(n)O(1)Easy
1513Number of Substrings With Only 1sC++PythonO(n)O(1)Medium
1525Number of Good Ways to Split a StringC++PythonO(n)O(1)Medium
1537Get the Maximum ScoreC++PythonO(m + n)O(1)Hard
1551Minimum Operations to Make Array EqualC++PythonO(1)O(1)Medium
1611Minimum One Bit Operations to Make Integers ZeroC++PythonO(logn)O(1)Hardvariant ofGray Code
1641Count Sorted Vowel StringsC++PythonO(1)O(1)MediumBinomial Coefficients
1643Kth Smallest InstructionsC++PythonO((m + n)^2)O(1)HardBinomial Coefficients
1735Count Ways to Make Array With ProductC++PythonO(sqrt(m) + n + q * (logm + sqrt(m)/log(sqrt(m))))O(sqrt(m) + n + logm)HardLinear Sieve of Eratosthenes, Factorization, Combinatorics
1739Building BoxesC++PythonO(1)O(1)Hard
1744Can You Eat Your Favorite Candy on Your Favorite Day?C++PythonO(n)O(n)MediumPrefix Sum
1753Maximum Score From Removing StonesC++PythonO(1)O(1)Medium
1776Car Fleet IIC++PythonO(n)O(n)HardMono Stack
1780Check if Number is a Sum of Powers of ThreeC++PythonO(logn)O(1)Medium
1806Minimum Number of Operations to Reinitialize a PermutationC++PythonO(sqrt(n))O(sqrt(n))MediumDiscrete Logarithm, Multiplicative Order
1808Maximize Number of Nice DivisorsC++PythonO(logn)O(1)Mediumvariant ofInteger Break
1812Determine Color of a Chessboard SquareC++PythonO(1)O(1)Easy
1819Number of Different Subsequences GCDsC++PythonO(n + mlogm)O(n)Hard
1822Sign of the Product of an ArrayC++PythonO(n)O(1)Easy
1823Find the Winner of the Circular GameC++PythonO(n)O(1)Medium
1828Queries on Number of Points Inside a CircleC++PythonO(q * n)O(1)Medium
1830Minimum Number of Operations to Make String SortedC++PythonO(n)O(max_n)HardModular Inverse
1835Find XOR Sum of All Pairs Bitwise ANDC++PythonO(n)O(1)Hard
1837Sum of Digits in Base KC++PythonO(logn)O(1)Easy
1860Incremental Memory LeakC++PythonO(1)O(1)MediumGCJ2020 - Round 2
1862Sum of Floored PairsC++PythonO(nlogn)O(n)Hard
1863Sum of All Subset XOR TotalsC++PythonO(n)O(1)Easy
1884Egg Drop With 2 Eggs and N FloorsC++PythonO(1)O(1)MediumDP
1904The Number of Full Rounds You Have PlayedC++PythonO(1)O(1)Medium
1916Count Ways to Build Rooms in an Ant ColonyC++PythonO(n)O(n)HardDFS, Tree
1922Count Good NumbersC++PythonO(logn)O(1)Medium
1945Sum of Digits of String After ConvertC++PythonO(n)O(1)Easy
1952Three DivisorsC++PythonO(sqrt(n))O(1)Easy
1954Minimum Garden Perimeter to Collect Enough ApplesC++PythonO(1)O(1)MediumBinary Search,Cardano's Formula
1969Minimum Non-Zero Product of the Array ElementsC++PythonO(min(p, logM))O(1)Medium
1979Find Greatest Common Divisor of ArrayC++PythonO(n)O(1)Easy
1980Find Unique Binary StringC++PythonO(n)O(1)MediumCantor Diagonalization
1982Find Array Given Subset SumsC++PythonO(n * 2^n)O(1)HardMath, DP, OrderedDict
2001Number of Pairs of Interchangeable RectanglesC++PythonO(n)O(n)MediumMath
2005Subtree Removal Game with Fibonacci TreeC++PythonO(1)O(1)Hard🔒Math,Sprague-Grundy Theorem,Colon Principle
2028Find Missing ObservationsC++PythonO(n)O(1)Medium
2029Stone Game IXC++PythonO(n)O(1)Medium
2063Vowels of All SubstringsC++PythonO(n)O(1)MediumCombinatorics
2073Time Needed to Buy TicketsC++PythonO(n)O(1)EasySimulation, Math
2083Substrings That Begin and End With the Same LetterC++PythonO(n)O(1)Medium🔒Combinatorics
2091Removing Minimum and Maximum From ArrayC++PythonO(n)O(1)MediumMath
2110Number of Smooth Descent Periods of a StockC++PythonO(n)O(1)MediumMath, Combinatorics
2117Abbreviating the Product of a RangeC++PythonO(r - l)O(1)HardMath
2119A Number After a Double ReversalC++PythonO(1)O(1)EasyMath
2125Number of Laser Beams in a BankC++PythonO(m * n)O(1)MediumMath
2133Check if Every Row and Column Contains All NumbersC++PythonO(n^2)O(n)EasyMath
2145Count the Hidden SequencesC++PythonO(n)O(1)MediumMath
2148Count Elements With Strictly Smaller and Greater ElementsC++PythonO(n)O(1)EasyMath
2152Minimum Number of Lines to Cover PointsC++PythonO(n * 2^n)O(n^2)Medium🔒Math, Hash Table, Bitmasks
2169Count Operations to Obtain ZeroC++PythonO(log(min(m, n)))O(1)EasyMath,Euclidean Algorithm
2171Removing Minimum Number of Magic BeansC++PythonO(nlogn)O(1)MediumMath, Sort
2176Count Equal and Divisible Pairs in an ArrayC++PythonO(nlogk + n * sqrt(k))O(n + sqrt(k))EasyMath
2177Find Three Consecutive Integers That Sum to a Given NumberC++PythonO(1)O(1)MediumMath
2180Count Integers With Even Digit SumC++PythonO(logn)O(1)EasyMath
2183Count Array Pairs Divisible by KC++PythonO(nlogk + k)O(sqrt(k))Hardvariant ofCount Equal and Divisible Pairs in an ArrayMath
2198Number of Single Divisor TripletsC++PythonO(d^3)O(d)Medium🔒Math, Combinatorics
2217Find Palindrome With Fixed LengthC++PythonO(n * l)O(1)MediumMath
2221Find Triangular Sum of an ArrayC++PythonO(n)O(1)MediumSimulation, Combinatorics, Number Thoery
2235Add Two IntegersC++PythonO(1)O(1)EasyMath
2240Number of Ways to Buy Pens and PencilsC++PythonO(sqrt(t))O(1)MediumMath
2244Minimum Rounds to Complete All TasksC++PythonO(n)O(n)MediumMath, Freq Table
2249Count Lattice Points Inside a CircleC++PythonO(n * r^2)O(min(n * r^2, max_x * max_y))MediumMath, Hash Table
2262Total Appeal of A StringC++PythonO(n)O(26)Hardvariant ofCount Unique Characters of All Substrings of a Given StringCombinatorics
2280Minimum Lines to Represent a Line ChartC++PythonO(nlogn)O(1)MediumSort, Math, GCD
2310Sum of Numbers With Units Digit KC++PythonO(1)O(1)MediumMath
2335Minimum Amount of Time to Fill CupsC++PythonO(1)O(1)EasyMath, Constructive Algorithms
2338Count the Number of Ideal ArraysC++PythonO(sqrt(m) + n + m * (logm + sqrt(m)/log(sqrt(m))))O(sqrt(m) + n + logm)Hardvariant ofCount Ways to Make Array With ProductDP,Linear Sieve of Eratosthenes, Factorization, Combinatorics
2344Minimum Deletions to Make Array DivisibleC++PythonO(n + m + logr)O(1)HardMath, GCD
2345Finding the Number of Visible MountainsC++PythonO(nlogn)O(1)Medium🔒Math, Sort, Mono Stack
2350Shortest Impossible Sequence of RollsC++PythonO(n)O(k)HardConstructive Algorithms
2358Maximum Number of Groups Entering a CompetitionC++PythonO(1)O(1)MediumConstructive Algorithms, Math
2376Count Special IntegersC++PythonO(logn)O(logn)Hardvariant ofNumbers With Repeated DigitsCombinatorics
2396Strictly Palindromic NumberC++PythonO(1)O(1)MediumMath
2400Number of Ways to Reach a Position After Exactly k StepsC++PythonO(k)O(k)MediumCombinatorics
2409Count Days Spent TogetherC++PythonO(1)O(1)EasyString, Math, Prefix Sum
2413Smallest Even MultipleC++PythonO(1)O(1)EasyMath, Bit Manipulation
2427Number of Common FactorsC++PythonO(log(min(a, b)) + sqrt(gcd))O(1)EasyMath
2437Number of Valid Clock TimesC++PythonO(1)O(1)EasyCombinatorics
2450Number of Distinct Binary Strings After Applying OperationsC++PythonO(logn)O(1)Medium🔒Combinatorics
2455Average Value of Even Numbers That Are Divisible by ThreeC++PythonO(n)O(1)EasyMath
2468Split Message Based on LimitC++PythonO(n + rlogr)O(1)HardBrute Force, Math
2469Convert the TemperatureC++PythonO(1)O(1)EasyMath
2481Minimum Cuts to Divide a CircleC++PythonO(1)O(1)EasyMath
2485Find the Pivot IntegerC++PythonO(1)O(1)EasyMath
2514Count AnagramsC++PythonO(n)O(n)HardMath, Combinatorics
2520Count the Digits That Divide a NumberC++PythonO(logn)O(1)EasyMath
2521Distinct Prime Factors of Product of ArrayC++Pythonprecompute:O(sqrt(MAX_N))
runtime:O(m + nlog(logn))
O(sqrt(MAX_N))MediumNumber Theory,Linear Sieve of Eratosthenes
2523Closest Prime Numbers in RangeC++Pythonprecompute:O(MAX_N * log(MAX_N))
runtime:O(log(MAX_N))
O(MAX_N)MediumNumber Theory,Linear Sieve of Eratosthenes, Segment Tree
2525Categorize Box According to CriteriaC++PythonO(1)O(1)EasyMath
2539Count the Number of Good SubsequencesC++PythonO(26 * n)O(n)Medium🔒Combinatorics
2543Check if Point Is ReachableC++PythonO(log(min(a, b)))O(1)HardNumber Theory
2544Alternating Digit SumC++PythonO(logn)O(1)EasyMath
2549Count Distinct Numbers on BoardC++PythonO(1)O(1)EasyMath
2550Count Collisions of Monkeys on a PolygonC++PythonO(logn)O(1)MediumCombinatorics, Fast Exponentiation
2562Find the Array Concatenation ValueC++PythonO(nlogr)O(1)EasyMath
2568Minimum Impossible ORC++PythonO(logr)O(1)MediumMath, Hash Table, Bit Manipulations


Sort

#TitleSolutionTimeSpaceDifficultyTagNote
1054Distant BarcodesC++PythonO(n)O(k)Mediumvariant ofRearrange String k Distance Apart
1086High FiveC++PythonO(nlogn)O(n)Easy🔒
1094Car PoolingC++PythonO(nlogn)O(n)Mediumvariant ofMeeting Rooms II
1122Relative Sort ArrayC++PythonO(nlogn)O(n)Easy
1229Meeting SchedulerC++PythonO(nlogn)O(n)MediumLine Sweep, Heap
1356Sort Integers by The Number of 1 BitsC++PythonO(nlogn)O(1)EasyBit Manipulation
1365How Many Numbers Are Smaller Than the Current NumberC++PythonO(n + m)O(m)EasyCounting Sort
1366Rank Teams by VotesC++PythonO(m * (n + mlogm))O(m^2)Medium
1451Rearrange Words in a SentenceC++PythonO(nlogn)O(n)MediumString
1481Least Number of Unique Integers after K RemovalsC++PythonO(n)O(n)MediumCounting Sort
1509Minimum Difference Between Largest and Smallest Value in Three MovesC++PythonO(n + klogk)O(1)MediumQuick Select
1523Count Odd Numbers in an Interval RangeC++PythonO(1)O(1)Easy
1561Maximum Number of Coins You Can GetC++PythonO(nlogn)O(1)Medium
1588Sum of All Odd Length SubarraysC++PythonO(n)O(1)Easy
1608Special Array With X Elements Greater Than or Equal XC++PythonO(n)O(1)Easyvariant ofH-IndexCounting Sort, Binary Search
1620Coordinate With Maximum Network QualityC++PythonO(n^2)O(1)Medium
1621Number of Sets of K Non-Overlapping Line SegmentsC++PythonO(1)O(n)MediumBinomial Coefficients,Euler's Theorem
1630Arithmetic SubarraysC++PythonO(n * q)O(n)MediumArithmetic Series
1636Sort Array by Increasing FrequencyC++PythonO(nlogn)O(n)Easy
1637Widest Vertical Area Between Two Points Containing No PointsC++PythonO(nlogn)O(n)Medium
1680Concatenation of Consecutive Binary NumbersC++PythonO(n)O(1)Medium
1685Sum of Absolute Differences in a Sorted ArrayC++PythonO(n)O(1)Medium
1688Count of Matches in TournamentC++PythonO(1)O(1)Easy
1703Minimum Adjacent Swaps for K Consecutive OnesC++PythonO(n)O(n)HardMath, Median, Prefix Sum
1716Calculate Money in Leetcode BankC++PythonO(1)O(1)EasyArithmetic Sequence
1772Sort Features by PopularityC++PythonO(n)O(1)Medium🔒
1847Closest RoomC++PythonO(nlogn + klogk + klogn)O(n + k)HardSort, Binary Search
1851Minimum Interval to Include Each QueryC++PythonO(nlogn + klogk + klogn)O(n + k)HardSort, Heap, Line Sweep
1859Sorting the SentenceC++PythonO(n)O(n)EasySort, String
1942The Number of the Smallest Unoccupied ChairC++PythonO(nlogn)O(n)MediumLine Sweep, Heap
1943Describe the PaintingC++PythonO(nlogn)O(n)MediumLine Sweep
1968Array With Elements Not Equal to Average of NeighborsC++PythonO(n) on averageO(1)Mediumvariant ofWiggle Sort IIQuick Select, Tri Partition
1985Find the Kth Largest Integer in the ArrayC++PythonO(n) on averageO(n)MediumQuick Select
1996The Number of Weak Characters in the GameC++PythonO(nlogn)O(1)Medium
2015Average Height of Buildings in Each SegmentC++PythonO(nlogn)O(n)Medium🔒Line Sweep
2021Brightest Position on StreetC++PythonO(nlogn)O(n)Medium🔒Line Sweep
2070Most Beautiful Item for Each QueryC++PythonO(nlogn + qlogn)O(1)MediumSort, Binary Search
2089Find Target Indices After Sorting ArrayC++PythonO(n)O(1)EasyCounting Sort
2158Amount of New Area Painted Each DayC++PythonO(nlogr)O(r)Hard🔒Line Sweep, Sorted List, Heap, Segment Tree
2164Sort Even and Odd Indices IndependentlyC++PythonO(n)O(c)EasyCounting Sort, Inplace
2191Sort the Jumbled NumbersC++PythonO(nlogm + nlogn)O(n)MediumSort
2231Largest Number After Digit Swaps by ParityC++PythonO(logn)O(1)EasyCounting Sort
2233Maximum Product After K IncrementsC++PythonO(n + k)O(n)MediumHeap, Freq Table, Sort, Math
2248Intersection of Multiple ArraysC++PythonO(n * l + r)O(l)EasyHash Table, Counting Sort
2251Number of Flowers in Full BloomC++PythonO(nlogn + mlogn)O(n)HardLine Sweep, Binary Search
2343Query Kth Smallest Trimmed NumberC++PythonO(q + n * t)O(t + n + q)MediumSort, Quick Select, Radix Sort
2418Sort the PeopleC++PythonO(nlogn)O(n)EasySort
2497Maximum Star Sum of a GraphC++PythonO(n)O(n)MediumSort, Quick Select
2512Reward Top K StudentsC++PythonO(pf * l + nf * l + n * l + klogk)O(pf * l + nf * l + n)MediumPartial Sort, Quick Select
2545Sort the Students by Their Kth ScoreC++PythonO(mlogm)O(1)MediumSort


Two Pointers

#TitleSolutionTimeSpaceDifficultyTagNote
1004Max Consecutive Ones IIIC++PythonO(n)O(1)MediumSliding Window
1033Moving Stones Until ConsecutiveC++PythonO(1)O(1)Easy
1040Moving Stones Until Consecutive IIC++PythonO(nlogn)O(1)Medium
1151Minimum Swaps to Group All 1's TogetherC++PythonO(n)O(1)Medium🔒Sliding Window
1156Swap For Longest Repeated Character SubstringC++PythonO(n)O(1)MediumSliding Window
1176Diet Plan PerformanceC++PythonO(n)O(1)EasySliding Window
1208Get Equal Substrings Within BudgetC++PythonO(n)O(1)MediumSliding Window
1213Intersection of Three Sorted ArraysC++PythonO(n)O(1)Easy🔒
1169Invalid TransactionsC++PythonO(nlogn)O(n)MediumSliding Window, Line Sweep
1214Two Sum BSTsC++PythonO(n)O(n)Medium🔒Stack
1234Replace the Substring for Balanced StringC++PythonO(n)O(t)MediumTwo Pointers, Sliding Window
1248Count Number of Nice SubarraysC++PythonO(n)O(k)Mediumvariant ofSubarrays with K Different IntegersTwo Pointers, Sliding Window
1297Maximum Number of Occurrences of a SubstringC++PythonO(n)O(n)MediumSliding Window,Rabin-Karp Algorithm
1305All Elements in Two Binary Search TreesC++PythonO(n)O(h)MediumStack
1316Distinct Echo SubstringsC++PythonO(n^2 + d)O(r)HardKMP Algorithm, Sliding Window,Rabin-Karp Algorithm
1358Number of Substrings Containing All Three CharactersC++PythonO(n)O(1)MediumSliding Window
1423Maximum Points You Can Obtain from CardsC++PythonO(n)O(1)MediumSliding Window
1425Constrained Subset SumC++PythonO(n)O(k)Hardvariant ofSliding Window MaximumMono Deque, Sliding Window
1456Maximum Number of Vowels in a Substring of Given LengthC++PythonO(n)O(1)MediumSliding Window
1493Longest Subarray of 1's After Deleting One ElementC++PythonO(n)O(1)MediumSliding Window
1498Number of Subsequences That Satisfy the Given Sum ConditionC++PythonO(nlogn)O(n)MediumTwo Pointers
1508Range Sum of Sorted Subarray SumsC++PythonO(nlog(sum(nums)))O(n)MediumBinary Search, Two Pointers, Sliding Window
1521Find a Value of a Mysterious Function Closest to TargetC++PythonO(nlogm)O(logm)HardDP, Two Pointers, Sliding Window
1604Alert Using Same Key-Card Three or More Times in a One Hour PeriodC++PythonO(nlogn)O(n)MediumTwo Pointers, Sliding Window
1658Minimum Operations to Reduce X to ZeroC++PythonO(n)O(1)MediumTwo Pointers
1687Delivering Boxes from Storage to PortsC++PythonO(nlogn)O(n)HardTwo Pointers, Sliding Window
1695Maximum Erasure ValueC++PythonO(n)O(n)MediumTwo Pointers, Sliding Window
1712Ways to Split Array Into Three SubarraysC++PythonO(n)O(n)MediumTwo Pointers, Prefix Sum
1750Minimum Length of String After Deleting Similar EndsC++PythonO(n)O(1)MediumTwo Pointers
1838Frequency of the Most Frequent ElementC++PythonO(nlogn)O(n)MediumTwo Pointers, Sliding Window
1852Distinct Numbers in Each SubarrayC++PythonO(n)O(k)Medium🔒Two Pointers, Sliding Window
1855Maximum Distance Between a Pair of ValuesC++PythonO(n + m)O(1)MediumTwo Pointers
1868Product of Two Run-Length Encoded ArraysC++PythonO(m + n)O(1)Medium🔒Two Pointers
1885Count Pairs in Two ArraysC++PythonO(nlogn)O(1)Medium🔒Two Pointers
1888Minimum Number of Flips to Make the Binary String AlternatingsC++PythonO(n)O(1)MediumTwo Pointers, Sliding Window
1984Minimum Difference Between Highest and Lowest of K ScoresC++PythonO(nlogn)O(1)EasyTwo Pointers, Sliding Window
1989Maximum Number of People That Can Be Caught in TagC++PythonO(n)O(1)Medium🔒Greedy, Two Pointers, Sliding Window
2009Minimum Number of Operations to Make Array ContinuousC++PythonO(nlogn)O(1)HardTwo Pointers, Sliding Window
2024Maximize the Confusion of an ExamC++PythonO(n)O(1)Mediumvariant ofLongest Repeating Character ReplacementSliding Window
2040Kth Smallest Product of Two Sorted ArraysC++PythonO((m + n) * logr)O(1)HardBinary Search, Two Pointers
2046Sort Linked List Already Sorted Using Absolute ValuesC++PythonO(n)O(1)Medium🔒Linked List
2062Count Vowel Substrings of a StringC++PythonO(n)O(1)Easyvariant ofCount Number of Nice SubarraysSliding Window
2067Number of Equal Count SubstringsC++PythonO(n)O(1)Medium🔒Sliding Window
2090K Radius Subarray AveragesC++PythonO(n)O(1)MediumSliding Window
2105Watering Plants IIC++PythonO(n)O(1)MediumSimulation
2107Number of Unique Flavors After Sharing K CandiesC++PythonO(n)O(n)Medium🔒Sliding Window
2134Minimum Swaps to Group All 1's Together IIC++PythonO(n)O(1)MediumSliding Window
2149Rearrange Array Elements by SignC++PythonO(n)O(1)MediumTwo Pointers
2161Partition Array According to Given PivotC++PythonO(n)O(n)MediumTwo Pointers
2200Find All K-Distant Indices in an ArrayC++PythonO(n)O(1)EasyTwo Pointers
2234Maximum Total Beauty of the GardensC++PythonO(nlogn)O(1)HardSort, Prefix Sum, Greedy, Binary Search, Two Pointers
2302Count Subarrays With Score Less Than KC++PythonO(n)O(1)HardTwo Pointers, Sliding Window
2330Valid Palindrome IVC++PythonO(n)O(1)Medium🔒String, Two Pointers
2332The Latest Time to Catch a BusC++PythonO(nlogn + mlogm)O(1)MediumString, Two Pointers
2337Move Pieces to Obtain a StringC++PythonO(n + m)O(1)MediumString, Two Pointers
2348Number of Zero-Filled SubarraysC++PythonO(n)O(1)MediumTwo Pointers, Combinatorics
2379Minimum Recolors to Get K Consecutive Black BlocksC++PythonO(n)O(1)EasySliding Window
2393Count Strictly Increasing SubarraysC++PythonO(n)O(1)Medium🔒Two Pointers
2401Longest Nice SubarrayC++PythonO(n)O(1)MediumSliding Window, Two Pointers
2444Count Subarrays With Fixed BoundsC++PythonO(n)O(1)Hardvariant ofNumber of Substrings Containing All Three CharactersTwo Pointers
2461Maximum Sum of Distinct Subarrays With Length KC++PythonO(n)O(k)MediumTwo Pointers
2465Number of Distinct AveragesC++PythonO(nlogn)O(n)EasyTwo Pointers, Hash Table
2511Maximum Enemy Forts That Can Be CapturedC++PythonO(n)O(1)EasyArray, Two Pointers
2516Take K of Each Character From Left and RightC++PythonO(n)O(1)MediumSliding Window, Two Pointers
2524Maximum Frequency Score of a SubarrayC++PythonO(n)O(n)Hard🔒Sliding Window, Two Pointers, Freq Table, Hash Table
2537Count the Number of Good SubarraysC++PythonO(n)O(n)MediumSliding Window, Two Pointers
2540Minimum Common ValueC++PythonO(n)O(1)EasyTwo Pointers
2555Maximize Win From Two SegmentsC++PythonO(n)O(n)MediumTwo Pointers, Sliding Window, DP
2563Count the Number of Fair PairsC++PythonO(nlogn)O(1)MediumSort, Two Pointers
2570Merge Two 2D Arrays by Summing ValuesC++PythonO(n)O(1)EasyTwo Pointers


Recursion

#TitleSolutionTimeSpaceDifficultyTagNote
1106Parsing A Boolean ExpressionC++PythonO(n)O(n)Hard


Binary Search

#TitleSolutionTimeSpaceDifficultyTagNote
1011Capacity To Ship Packages Within D DaysC++PythonO(nlogr)O(1)Medium
1044Longest Duplicate SubstringC++PythonO(nlogn)O(n)HardRabin-Karp Algorithm, Suffix Tree,Ukkonen's Algorithm
1060Missing Element in Sorted ArrayC++PythonO(logn)O(1)Medium🔒
1062Longest Repeating SubstringC++PythonO(nlogn)O(n)Medium🔒Rabin-Karp Algorithm
1064Fixed PointC++PythonO(logn)O(1)Easy🔒
1095Find in Mountain ArrayC++PythonO(logn)O(1)Hard
1110Delete Nodes And Return ForestC++PythonO(n)O(h + d)Medium
1170Compare Strings by Frequency of the Smallest CharacterC++PythonO((m + n)logn)O(n)Easy
1201Ugly Number IIIC++PythonO(logn)O(1)MediumInclusion-Exclusion Principle
1228Missing Number In Arithmetic ProgressionC++PythonO(logn)O(1)Easy
1231Divide ChocolateC++PythonO(nlogn)O(1)Hard
1274Number of Ships in a RectangleC++PythonO(log(m * n))O(log(m * n))HardDivide and Conquer
1283Find the Smallest Divisor Given a ThresholdC++PythonO(logn)O(1)Medium
1287Element Appearing More Than 25% In Sorted ArrayC++PythonO(logn)O(1)Easy
1385Find the Distance Value Between Two ArraysC++PythonO((n + m) * logm)O(1)EasyBinary Search, Two Pointers
1482Minimum Number of Days to Make m BouquetsC++PythonO(nlogd)O(1)Medium
1533Find the Index of the Large IntegerC++PythonO(logn)O(1)Medium🔒
1539Kth Missing Positive NumberC++PythonO(logn)O(1)Easy
1552Magnetic Force Between Two BallsC++PythonO(nlogn + nlogr)O(1)Medium
1618Maximum Font to Fit a Sentence in a ScreenC++PythonO(n + logm)O(1)Medium🔒
1648Sell Diminishing-Valued Colored BallsC++PythonO(nlogm)O(1)Medium
1671Minimum Number of Removals to Make Mountain ArrayC++PythonO(nlogn)O(n)Mediumvariant ofLongest Increasing SubsequenceBinary Search, DP
1713Minimum Operations to Make a SubsequenceC++PythonO(nlogn)O(n)Hardvariant ofLongest Increasing SubsequenceBinary Search, Segment Tree
1760Minimum Limit of Balls in a BagC++PythonO(nlogm)O(1)Medium
1802Maximum Value at a Given Index in a Bounded ArrayC++PythonO(logm)O(1)Medium
1818Minimum Absolute Sum DifferenceC++PythonO(nlogn)O(n)Medium
1870Minimum Speed to Arrive on TimeC++PythonO(nlogr)O(1)Medium
1889Minimum Space Wasted From PackagingC++PythonO(mlogm + nlogn + mlogn)O(1)Hard
1891Cutting RibbonsC++PythonO(nlogr)O(1)Medium🔒
1898Maximum Number of Removable CharactersC++PythonO(rlogn)O(r)Medium
1901Find a Peak Element IIC++PythonO(min(n, m) * log(max(n, m)))O(1)Medium
1918Kth Smallest Subarray SumC++PythonO(nlogr)O(1)Medium🔒
1964Find the Longest Valid Obstacle Course at Each PositionC++PythonO(nlogn)O(n)Hardvariant ofLongest Increasing SubsequenceBinary Search, Segment Tree, DP
2064Minimized Maximum of Products Distributed to Any StoreC++PythonO(nlogm)O(1)Mediumvariant ofMinimum Limit of Balls in a Bag
2111Minimum Operations to Make the Array K-IncreasingC++PythonO(nlog(n/k))O(n/k)Hardvariant ofLongest Increasing Subsequence
2137Pour Water Between Buckets to Make Water Levels EqualC++PythonO(nlogr)O(1)Medium🔒
2187Minimum Time to Complete TripsC++PythonO(nlogr)O(1)Medium
2226Maximum Candies Allocated to K ChildrenC++PythonO(nlogr)O(1)MediumBinary Search
2250Count Number of Rectangles Containing Each PointC++PythonO(nlogn + m * max_y * logn)O(n)MediumBucket Sort, Binary Search
2300Successful Pairs of Spells and PotionsC++PythonO(mlogm + nlogm)O(1)MediumBinary Search
2333Minimum Sum of Squared DifferenceC++PythonO(nlogn + nlogr)O(1)MediumBinary Search
2387Median of a Row Wise Sorted MatrixC++PythonO(logr * mlogn)O(1)Medium🔒Binary Search
2389Longest Subsequence With Limited SumC++PythonO(nlogn + qlogn)O(1)EasyGreedy, Sort, Binary Search
2448Minimum Cost to Make Array EqualC++PythonO(nlogn)O(n)HardMath, Binary Search, Prefix Sum
2476Closest Nodes Queries in a Binary Search TreeC++PythonO(n + qlogn)O(n)HardDFS, Binary Search
2513Minimize the Maximum of Two ArraysC++PythonO(log(min(d1, d2)))O(1)MediumNumber Theory, Binary Search
2517Maximum Tastiness of Candy BasketC++PythonO(nlogr)O(1)MediumBinary Search, Greedy
2528Maximize the Minimum Powered CityC++PythonO(nlogk)O(n)HardBinary Search, Sliding Window, Greedy
2529Maximum Count of Positive Integer and Negative IntegerC++PythonO(logn)O(1)EasyBinary Search
2554Maximum Number of Integers to Choose From a Range IC++PythonO(b)O(b)MediumMath, Binary Search, Prefix Sum, Greedy
2557Maximum Number of Integers to Choose From a Range IIC++PythonO(b)O(b)Medium🔒Math, Binary Search, Prefix Sum
2560House Robber IVC++PythonO(nlogn)O(n)MediumBinary Search, Greedy


Binary Search Tree

#TitleSolutionTimeSpaceDifficultyTagNote
1373Maximum Sum BST in Binary TreeC++PythonO(n)O(h)HardDFS, Stack
1382Balance a Binary Search TreeC++PythonO(n)O(h)MediumDFS, Stack
1902Depth of BST Given Insertion OrderC++PythonO(nlogn)O(n)Medium🔒Sorted Dict
1932Merge BSTs to Create Single BSTC++PythonO(n)O(n)HardBST, BFS
2426Number of Pairs Satisfying InequalityC++PythonO(nlogn)O(n)HardMerge Sort, Two Pointers, BIT, Fenwick Tree, Coordinate Compression, Sorted List, Ordered Set, Binary Search


Breadth-First Search

#TitleSolutionTimeSpaceDifficultyTagNote
1034Coloring A BorderC++PythonO(m * n)O(m + n)Medium
1036Escape a Large MazeC++PythonO(n^2)O(n)Hard
1091Shortest Path in Binary MatrixC++PythonO(n^2)O(n)Medium
1102Path With Maximum Minimum ValueC++PythonO((m * n) * log(m * n))O(m * n)Medium🔒Binary Search, DFS,Dijkstra's Algorithm
1129Shortest Path with Alternating ColorsC++PythonO(n + e)O(n + e)Medium
1136Parallel CoursesC++PythonO(|V| + |E|)O(|E|)Hard🔒Topological Sort
1161Maximum Level Sum of a Binary TreeC++PythonO(n)O(w)MediumDFS
1162As Far from Land as PossibleC++PythonO(m * n)O(m * n)Medium
1203Sort Items by Groups Respecting DependenciesC++PythonO(n + e)O(n + e)HardTopological Sort
1210Minimum Moves to Reach Target with RotationsC++PythonO(n)O(n)Hard
1215Stepping NumbersC++PythonO(logk + r)O(k)Medium🔒Precompute, Binary Search
1245Tree DiameterC++PythonO(|V| + |E|)O(|E|)Medium
1263Minimum Moves to Move a Box to Their Target LocationC++PythonO(m^2 * n^2)O(m^2 * n^2)HardA* Search Algorithm
1284Minimum Number of Flips to Convert Binary Matrix to Zero MatrixC++PythonO((m * n) * 2^(m * n))O((m * n) * 2^(m * n))Hard
1291Sequential DigitsC++PythonO(1)O(1)Medium
1293Shortest Path in a Grid with Obstacles EliminationC++PythonO(m * n * k)O(m * n)HardA* Search Algorithm
1298Maximum Candies You Can Get from BoxesC++PythonO(n^2)O(n)Hard
1302Deepest Leaves SumC++PythonO(n)O(w)Medium
1306Jump Game IIIC++PythonO(n)O(n)Medium
1311Get Watched Videos by Your FriendsC++PythonO(n + vlogv)O(w)Medium
1345Jump Game IVC++PythonO(n)O(n)Hard
1368Minimum Cost to Make at Least One Valid Path in a GridC++PythonO(m * n)O(m * n)HardA* Search Algorithm, 0-1 BFS, Deque
1514Path with Maximum ProbabilityC++PythonO(|E| * log|V|)O(|E|)MediumDijkstra's Algorithm
1602Find Nearest Right Node in Binary TreeC++PythonO(n)O(w)Medium🔒
1609Even Odd TreeC++PythonO(n)O(w)Medium
1625Lexicographically Smallest String After Applying OperationsC++PythonO(n^2)O(1)MediumBFS, String
1654Minimum Jumps to Reach HomeC++PythonO(max(x, max(forbidden)) + a + b)O(max(x, max(forbidden)) + a + b)MediumBFS
1660Correct a Binary TreeC++PythonO(n)O(w)Medium🔒BFS
1728Cat and Mouse IIC++PythonO((m * n)^2 * (m + n))O((m * n)^2)Hardvariant ofCat and MouseMiniMax, Topological Sort
1730Shortest Path to Get FoodC++PythonO(m * n)O(m + n)Medium🔒BFS
1765Map of Highest PeakC++PythonO(m * n)O(m * n)MediumBFS
1926Nearest Exit from Entrance in MazeC++PythonO(m * n)O(m + n)MediumBi-BFS
1928Minimum Cost to Reach Destination in TimeC++PythonO(|E| * log|V|)O(|E|)Hardvariant ofCheapest Flights Within K StopsDijkstra's Algorithm
2039The Time When the Network Becomes IdleC++PythonO(|E|)O(|E|)MediumMath
2045Second Minimum Time to Reach DestinationC++PythonO(|E|)O(|E|)HardBi-BFS
2050Parallel Courses IIIC++PythonO(|V| + |E|)O(|E|)Hardvariant ofParallel CoursesTopological Sort
2059Minimum Operations to Convert NumberC++PythonO(m * n)O(m)Medium
2115Find All Possible Recipes from Given SuppliesC++PythonO(|E|)O(|E|)MediumTopological Sort
2146K Highest Ranked Items Within a Price RangeC++PythonO(m * n + klogk)O(m * n)MediumBFS, Quick Select, Sort
2258Escape the Spreading FireC++PythonO(m * n)O(m * n)HardBFS
2290Minimum Obstacle Removal to Reach CornerC++PythonO(m * n)O(m * n)Hardvariant ofMinimum Cost to Make at Least One Valid Path in a GridA* Search Algorithm, 0-1 BFS, Deque
2316Count Unreachable Pairs of Nodes in an Undirected GraphC++PythonO(n)O(n)MediumFlood Fill, BFS, Math
2368Reachable Nodes With RestrictionsC++PythonO(n)O(n)MediumBFS
2415Reverse Odd Levels of Binary TreeC++PythonO(n)O(n)MediumBFS
2471Minimum Number of Operations to Sort a Binary Tree by LevelC++PythonO(nlogn)O(w)MediumSort, BFS
2492Minimum Score of a Path Between Two CitiesC++PythonO(n + m)O(n + m)MediumBFS
2493Divide Nodes Into the Maximum Number of GroupsC++PythonO(n^2)O(n)Mediumvariant ofIs Graph Bipartite?BFS, DFS
2503Maximum Number of Points From Grid QueriesC++PythonO((m * n + q) * log(m * n))O(m * n)HardBFS, Heap, Prefix Sum, Binary Search


Depth-First Search

#TitleSolutionTimeSpaceDifficultyTagNote
1020Number of EnclavesC++PythonO(m * n)O(m * n)Medium
1059All Paths from Source Lead to DestinationC++PythonO(n + e)O(n + e)Medium🔒
1192Critical Connections in a NetworkC++PythonO(|V| + |E|)O(|V| + |E|)HardTarjan's Algorithm,Bridge Finding Algorithm
1202Smallest String With SwapsC++PythonO(nlogn)O(n)MediumUnion Find
1254Number of Closed IslandsC++PythonO(m * n)O(1)Medium
1273Delete Tree NodesC++PythonO(n)O(n)MediumDFS, DP
1315Sum of Nodes with Even-Valued GrandparentC++PythonO(n)O(h)Medium
1319Number of Operations to Make Network ConnectedC++PythonO(|E| + |V|)O(|V|)MediumUnion Find
1367Linked List in Binary TreeC++PythonO(n + l)O(h + l)MediumKMP Algorithm
1372Longest ZigZag Path in a Binary TreeC++PythonO(n)O(h)Medium
1376Time Needed to Inform All EmployeesC++PythonO(n)O(n)Medium
1377Frog Position After T SecondsC++PythonO(n)O(n)HardDFS, Stack, BFS
1391Check if There is a Valid Path in a GridC++PythonO(m * n)O(1)MediumSimulation
1466Reorder Routes to Make All Paths Lead to the City ZeroC++PythonO(n)O(n)MediumDFS, Stack
1485Clone Binary Tree With Random PointerC++PythonO(n)O(h)Medium🔒DFS, Stack
1644Lowest Common Ancestor of a Binary Tree IIC++PythonO(n)O(h)Medium🔒DFS, Stack
1676Lowest Common Ancestor of a Binary Tree IVC++PythonO(n)O(h)Medium🔒DFS, Stack
1722Minimize Hamming Distance After Swap OperationsC++PythonO(n)O(n)MediumFlood Fill, Union Find
1740Find Distance in a Binary TreeC++PythonO(n)O(h)Mediumvariant ofLowest Common Ancestor of a Binary Tree, 🔒
1766Tree of CoprimesC++PythonO(n)O(n)Hard
1905Count Sub IslandsC++PythonO(m * n)O(1)MediumFlood Fill
1973Count Nodes Equal to Sum of DescendantsC++PythonO(n)O(h)Medium🔒
2049Count Nodes With the Highest ScoreC++PythonO(n)O(n)Medium
2065Maximum Path Quality of a GraphC++PythonO(|V| + |E| + 4^10)O(|V| + |E| )HardPruning
2192All Ancestors of a Node in a Directed Acyclic GraphC++PythonO(|V| * |E|)O(|V| + |E|)MediumDFS, BFS, Topological Sort
2246Longest Path With Different Adjacent CharactersC++PythonO(n)O(h)HardDFS, BFS, Topological Sort
2265Count Nodes Equal to Average of SubtreeC++PythonO(n)O(h)MediumDFS, Tree
2322Minimum Score After Removals on a TreeC++PythonO(n^2)O(n)HardDFS, Tree
2331Evaluate Boolean Binary TreeC++PythonO(n)O(h)EasyDFS
2385Amount of Time for Binary Tree to Be InfectedC++PythonO(n)O(h)MediumBFS, DFS, Tree DP
2445Number of Nodes With Value OneC++PythonO(q + h)O(q + h)Medium🔒Tree, DFS, BFS
2458Height of Binary Tree After Subtree Removal QueriesC++PythonO(n)O(n)HardTree, DFS
2467Most Profitable Path in a TreeC++PythonO(n)O(n)MediumTree, DFS
2477Minimum Fuel Cost to Report to the CapitalC++PythonO(n)O(h)MediumTree, DFS


Backtracking

#TitleSolutionTimeSpaceDifficultyTagNote
1087Brace ExpansionC++PythonO(p * l * log(p * l))O(p * l)Medium🔒
1096Brace Expansion IIC++PythonO(p * l * log(p * l))O(p * l)Hard
1219Path with Maximum GoldC++PythonO(m^2 * n^2)O(m * n)Medium
1240Tiling a Rectangle with the Fewest SquaresC++PythonO(n^2 * m^2 * m^(n * m))O(n * m)Hard
1255Maximum Score Words Formed by LettersC++PythonO(n * 2^n)O(n)Hard
1258Synonymous SentencesC++PythonO(p * l * log(p * l))O(p * l)MediumUnion Find
1307Verbal Arithmetic PuzzleC++PythonO(10! * n * l)O(n * l)Hard
1379Find a Corresponding Node of a Binary Tree in a Clone of That TreeC++PythonO(n)O(h)MediumStack
1593Split a String Into the Max Number of Unique SubstringsC++PythonO(n * 2^(n - 1))O(n)Medium
1659Maximize Grid HappinessC++PythonO(C(m * n, i) * C(m * n - i, e))O(min(m * n, i + e))HardPruning
1718Construct the Lexicographically Largest Valid SequenceC++PythonO(n!)O(b)MediumBacktracking
1723Find Minimum Time to Finish All JobsC++PythonO(k^n * logr)O(n + k)HardBacktracking, Pruning, Binary Search
1849Splitting a String Into Descending Consecutive ValuesC++PythonO(n^2)O(n)Medium
1999Smallest Greater Multiple Made of Two DigitsC++PythonO(1)O(1)Medium🔒Backtracking, Bit Manipulation
2014Longest Subsequence Repeated k TimesC++PythonO(n * (n/k)!)O(n/k)Hard
2056Number of Valid Move Combinations On ChessboardC++PythonO(1)O(1)Hard
2094Finding 3-Digit Even NumbersC++PythonO(n)O(1)Easy
2443Sum of Number and Its ReverseC++PythonO(n^(1/(2*log2(10))))O(log10(n)/2)MediumBrute Force, Backtracking


Dynamic Programming

#TitleSolutionTimeSpaceDifficultyTagNote
1027Longest Arithmetic SequenceC++PythonO(n^2)O(n^2)Medium
1035Uncrossed LinesC++PythonO(m * n)O(min(m, n))Medium
1039Minimum Score Triangulation of PolygonC++PythonO(n^3)O(n^2)Medium
1043Partition Array for Maximum SumC++PythonO(n * k)O(k)Medium
1048Longest String ChainC++PythonO(n * l^2)O(n * l)Medium
1049Last Stone Weight IIC++PythonO(2^n)O(2^n)Medium
1066Campus Bikes IIC++PythonO(w * b * 2^b)O(w * b * 2^b)Medium🔒
1092Shortest Common SupersequenceC++PythonO(m * n)O(m * n)Hard
1105Filling Bookcase ShelvesC++PythonO(n^2)O(n)Medium
1125Smallest Sufficient TeamC++PythonO(m * 2^n)O(2^n)Hard
1137N-th Tribonacci NumberC++PythonO(logn)O(1)Easyvariant ofFibonacci NumberMatrix Exponentiation
1139Largest 1-Bordered SquareC++PythonO(n^3)O(n^2)Medium
1140Stone Game IIC++PythonO(n*(logn)^2)O(nlogn)Medium
1143Longest Common SubsequenceC++PythonO(m * n)O(min(m, n))Medium
1155Number of Dice Rolls With Target SumC++PythonO(d * f * t)O(t)Medium
1182Shortest Distance to Target ColorC++PythonO(n)O(n)Medium🔒
1186Maximum Subarray Sum with One DeletionC++PythonO(n)O(1)Medium
1187Make Array Strictly IncreasingC++PythonO(n^2 * logn)O(n)Hard
1191K-Concatenation Maximum SumC++PythonO(n)O(1)Medium
1216Valid Palindrome IIIC++PythonO(n^2)O(n)Hard🔒, variant ofLongest Palindromic Subsequence
1218Longest Arithmetic Subsequence of Given DifferenceC++PythonO(n)O(n)Medium
1220Count Vowels PermutationC++PythonO(logn)O(1)HardMatrix Exponentiation
1223Dice Roll SimulationC++PythonO(m * n)O(m)Medium
1230Toss Strange CoinsC++PythonO(n^2)O(n)Medium
1235Maximum Profit in Job SchedulingC++PythonO(nlogn)O(n)HardDP, Heap
1239Maximum Length of a Concatenated String with Unique CharactersC++PythonO(n) ~O(2^n)O(1) ~O(2^n)MediumDP, Bit Manipulation
1246Palindrome RemovalC++PythonO(n^3)O(n^2)Hard
1262Greatest Sum Divisible by ThreeC++PythonO(n)O(1)Medium
1269Number of Ways to Stay in the Same Place After Some StepsC++PythonO(n^2)O(n)Hard
1277Count Square Submatrices with All OnesC++PythonO(m * n)O(1)Medium
1278Palindrome Partitioning IIIC++PythonO(k * n^2)O(n^2)Hard
1289Minimum Falling Path Sum IIC++PythonO(m * n)O(1)Hard
1292Maximum Side Length of a Square with Sum Less than or Equal to ThresholdC++PythonO(m * n * log(min(m, n)))O(m * n)MediumBinary Search
1301Number of Paths with Max ScoreC++PythonO(n^2)O(n)Hard
1312Minimum Insertion Steps to Make a String PalindromeC++PythonO(n^2)O(n)Hardvariant ofLongest Common Subsequence
1314Matrix Block SumC++PythonO(m * n)O(m * n)Mediumvariant ofRange Sum Query 2D - Immutable
1320Minimum Distance to Type a Word Using Two FingersC++PythonO(n)O(1)Hard
1335Minimum Difficulty of a Job ScheduleC++PythonO(d * n^2)O(d * n)Hard
1340Jump Game VC++PythonO(n)O(n)HardSliding Window, Mono Stack, Segment Tree
1387Sort Integers by The Power ValueC++PythonO(n) on averageO(n)MediumQuick Select
1388Pizza With 3n SlicesC++PythonO(n^2)O(n)Hardvariant ofHouse Robber II
1395Count Number of TeamsC++PythonO(n^2)O(1)Medium
1397Find All Good StringsC++PythonO(m * n)O(m)HardKMP Algorithm
1406Stone Game IIIC++PythonO(n)O(1)Hard
1411Number of Ways to Paint N × 3 GridC++PythonO(logn)O(1)HardMatrix Exponentiation
1416Restore The ArrayC++PythonO(nlogk)O(logk)Hard
1420Build Array Where You Can Find The Maximum Exactly K ComparisonsC++PythonO(n * m * k)O(m * k)Hard
1434Number of Ways to Wear Different Hats to Each OtherC++PythonO(h * 2^n)O(2^n)Hard
1444Number of Ways of Cutting a PizzaC++PythonO(m * n * k * (m + n))O(m * n * k)Hard
1449Form Largest Integer With Digits That Add up to TargetC++PythonO(t)O(t)Hard
1458Max Dot Product of Two SubsequencesC++PythonO(m * n)O(min(m, n))Hard
1463Cherry Pickup IIC++PythonO(m * n^2)O(n^2)Hard
1467Probability of a Two Boxes Having The Same Number of Distinct BallsC++PythonO(k^3 * n^2)O(k^2 * n)HardBinomial Coefficients
1473Paint House IIIC++PythonO(m * t * n^2)O(t * n)Hard
1477Find Two Non-overlapping Sub-arrays Each With Target SumC++PythonO(n)O(n)Medium
1478Allocate MailboxesC++PythonO(m * n^2)O(n)HardDP, Math, Median
1494Parallel Courses IIC++PythonO((n * C(c, min(c, k))) * 2^n)O(2^n)HardCombinations
1504Count Submatrices With All OnesC++PythonO(m * n)O(n)MediumMono Stack
1510Stone Game IVC++PythonO(n * sqrt(n))O(n)Hard
1524Number of Sub-arrays With Odd SumC++PythonO(n)O(1)Medium
1531String Compression IIC++PythonO(n^2 * k)O(n * k)Hard
1547Minimum Cost to Cut a StickC++PythonO(n^3)O(n^2)Hard
1548The Most Similar Path in a GraphC++PythonO(n^ * m)O(n * m)Hard🔒
1553Minimum Number of Days to Eat N OrangesC++PythonO((logn)^2)O((logn)^2)Hard
1563Stone Game VC++PythonO(n^2)O(n^2)Hard
1569Number of Ways to Reorder Array to Get Same BSTC++PythonO(n^2)O(n^2)HardDFS
1575Count All Possible RoutesC++PythonO(nlogn + n * f)O(n * f)HardMath
1594Maximum Non Negative Product in a MatrixC++PythonO(m * n)O(n)Medium
1595Minimum Cost to Connect Two Groups of PointsC++PythonO(m * n * 2^n)O(2^n)Hard
1617Count Subtrees With Max Distance Between CitiesC++PythonO(n^6)O(n^3)HardBacktracking, Graph
1626Best Team With No ConflictsC++PythonO(nloga)O(n)Mediumvariant ofLongest Increasing SubsequenceSort, DP, Segment Tree
1639Number of Ways to Form a Target String Given a DictionaryC++PythonO(l * (w + n))O(n)Hard
1655Distribute Repeating IntegersC++PythonO(n + m * 3^m)O(n + 2^m)HardSubmask Enumeration
1664Ways to Make a Fair ArrayC++PythonO(n)O(1)MediumPrefix Sum
1681Minimum IncompatibilityC++PythonO(max(n * 2^n, 3^n))O(2^n)HardCombinations, Backtracking, Submask Enumeration
1682Longest Palindromic Subsequence IIC++PythonO(n^2)O(n)Medium🔒
1690Stone Game VIIC++PythonO(n^2)O(n)Medium
1691Maximum Height by Stacking CuboidsC++PythonO(n^2)O(n)Hard
1692Count Ways to Distribute CandiesC++PythonO(n * k)O(k)Hard🔒
1745Palindrome Partitioning IVC++PythonO(n^2)O(n)HardDP,Manacher's Algorithm
1746Maximum Subarray Sum After One OperationC++PythonO(n)O(1)Mediumvariant ofMaximum Subarray, 🔒
1751Maximum Number of Events That Can Be Attended IIC++PythonO(nlogn + n * k)O(n * k)HardBinary Search
1770Maximum Score from Performing Multiplication OperationsC++PythonO(m^2)O(m)Medium
1771Maximize Palindrome Length From SubsequencesC++PythonO((m + n)^2)O((m + n)^2)Hard
1774Closest Dessert CostC++PythonO(m * t)O(t)Medium
1787Make the XOR of All Segments Equal to ZeroC++PythonO(n + k * m)O(min(k * m, n))Hard
1799Maximize Score After N OperationsC++PythonO(n^2 * 2^n)O(2^n)Hard
1803Count Pairs With XOR in a RangeC++PythonO(n)O(n)HardDP, Trie
1857Largest Color Value in a Directed GraphC++PythonO(n + m)O(n + m)HardDP, Topological Sort
1866Number of Ways to Rearrange Sticks With K Sticks VisibleC++PythonO(n * k)O(k)Hard
1871Jump Game VIIC++PythonO(n)O(n)MediumLine Sweep, DP, BFS
1872Stone Game VIIIC++PythonO(n)O(1)Hard
1883Minimum Skips to Arrive at Meeting On TimeC++PythonO(n^2)O(n)Hard
1896Minimum Cost to Change the Final Value of ExpressionC++PythonO(n)O(n)HardStack, DP
1900The Earliest and Latest Rounds Where Players CompeteC++PythonO(n^4)O(n^2)Hard
1908Game of NimC++PythonO(n)O(1)Medium🔒
1931Painting a Grid With Three Different ColorsC++PythonO(2^(3 * m) * logn)O(2^(2 * m))Hardvariant ofNumber of Ways to Paint N × 3 GridDP, Backtracking, Matrix Exponentiation, State Compression
1937Maximum Number of Points with CostC++PythonO(m * n)O(n)MediumPrefix Sum
1955Count Number of Special SubsequencesC++PythonO(n)O(1)Hard
1959Minimum Total Space Wasted With K Resizing OperationsC++PythonO(k * n^2)O(k * n)Medium
1960Maximum Product of the Length of Two Palindromic SubstringsC++PythonO(n)O(n)HardManacher's Algorithm, DP
1977Number of Ways to Separate NumbersC++PythonO(n^2)O(n^2)HardDP
1981Minimize the Difference Between Target and Chosen ElementsC++PythonO(t * m * n)O(t)MediumDP, Pruning
1986Minimum Number of Work Sessions to Finish the TasksC++PythonO(n * 2^n)O(2^n)MediumDP
1987Number of Unique Good SubsequencesC++PythonO(n)O(1)Hardvariant ofDistinct Subsequences IIDP
1994The Number of Good SubsetsC++PythonO(n * 2^p)O(2^p)HardDP,Sieve of Eratosthenes
1997First Day Where You Have Been in All the RoomsC++PythonO(n)O(n)MediumDP
2002Maximum Product of the Length of Two Palindromic SubsequencesC++PythonO(3^n)O(2^n)MediumDP, Submask Enumeration
2008Maximum Earnings From TaxiC++PythonO(n + mlogm)O(n)MediumDP
2019The Score of Students Solving Math ExpressionC++PythonO(n^3 * a^2)O(n^2)Hardvariant ofBurst Balloons
2031Count Subarrays With More Ones Than ZerosC++PythonO(n)O(n)Medium🔒Prefix Sum, DP
2044Count Number of Maximum Bitwise-OR SubsetsC++PythonO(min(2^n, m * n))O(min(2^n, m))MediumDP
2052Minimum Cost to Separate Sentence Into RowsC++PythonO(s + n * k)O(k)Medium🔒DP
2060Check if an Original String Exists Given Two Encoded StringsC++PythonO(m * n * k)O(min(m, n) * k)HardDP, Memoization
2088Count Fertile Pyramids in a LandC++PythonO(m * n)O(n)HardDP
2140Solving Questions With BrainpowerC++PythonO(n)O(n)MediumDP
2143Choose Numbers From Two Arrays in RangeC++PythonO(n^2 * v)O(n * v)Hard🔒DP
2167Minimum Time to Remove All Cars Containing Illegal GoodsC++PythonO(n)O(1)HardDP
2174Remove All Ones With Row and Column Flips IIC++PythonO((m * n) * 2^(m * n))O(2^(m * n))Medium🔒DP, Bitmasks
2184Number of Ways to Build Sturdy Brick WallC++PythonO(h * p^2)O(p^2)Medium🔒, variant ofPainting a Grid With Three Different ColorsDP, Backtracking, Matrix Exponentiation
2188Minimum Time to Finish the RaceC++PythonO((n + l) * logc)O(n + l + logc)HardGreedy, DP
2189Number of Ways to Build House of CardsC++PythonO(n^2)O(n)Medium🔒DP
2209Minimum White Tiles After Covering With CarpetsC++PythonO(m * n)O(m * n)HardDP
2218Maximum Value of K Coins From PilesC++PythonO(min(n * k^2, m * k)))O(k)HardDP
2222Number of Ways to Select BuildingsC++PythonO(n)O(1)MediumDP
2247Maximum Cost of Trip With K HighwaysC++PythonO(n^2 * 2^n)O(n * 2^n)Hard🔒DP, Bitmasks, BFS
2266Count Number of TextsC++PythonO(n)O(1)MediumDP
2267Check if There Is a Valid Parentheses String PathC++PythonO(m * n * (m + n) / 32)O(n * (m + n) / 32)Hardvariant ofCodeforces Round #801 CDP, Bitsets
2289Steps to Make Array Non-decreasingC++PythonO(n)O(n)HardDP, Mono Stack
2291Maximum Profit From Trading StocksC++PythonO(n * b)O(b)Medium🔒DP
2297Jump Game IXC++PythonO(n)O(1)Medium🔒DP, Mono Stack
2304Minimum Path Cost in a GridC++PythonO(m * n^2)O(n)MediumDP
2305Fair Distribution of CookiesC++PythonO(k * 3^n)O(2^n)MediumDP, Submask Enumeration
2312Selling Pieces of WoodC++PythonO(m * n * (m + n))O(m + n)HardDP
2313Minimum Flips in Binary Tree to Get ResultC++PythonO(n)O(h)Hard🔒Tree DP
2318Number of Distinct Roll SequencesC++PythonO(6^3 * n)O(6^2)HardDP
2320Count Number of Ways to Place HousesC++PythonO(logn)O(1)Mediumvariant ofFibonacci NumberMatrix Exponentiation
2327Number of People Aware of a SecretC++PythonO(n)O(f)MediumDP
2328Number of Increasing Paths in a GridC++PythonO(m * n)O(m * n)HardMemoization, Topological Sort, DP
2361Minimum Costs Using the Train LineC++PythonO(n)O(1)Hard🔒DP
2369Check if There is a Valid Partition For The ArrayC++PythonO(n)O(1)MediumDP
2370Longest Ideal SubsequenceC++PythonO(n)O(1)MediumDP
2378Choose Edges to Maximize Score in a TreeC++PythonO(n)O(n)Medium🔒DFS, Stack, Tree DP
2380Time Needed to Rearrange a Binary StringC++PythonO(n)O(1)MediumDP
2403Minimum Time to Kill All MonstersC++PythonO(n * 2^n)O(2^n)Hard🔒Bitmasks, DP
2420Find All Good IndicesC++PythonO(n)O(n)MediumPrefix Sum
2430Maximum Deletions on a StringC++PythonO(n^2)O(n)HardDP,Rabin-Karp Algorithm, Rolling Hash, Longest Prefix Suffix,KMP Algorithm
2431Maximize Total Tastiness of Purchased FruitsC++PythonO(n * a * c)O(a * c)Medium🔒DP
2435Paths in Matrix Whose Sum Is Divisible by KC++PythonO(m * n * k)O(n * k)HardDP
2447Number of Subarrays With GCD Equal to KC++PythonO(nlogr)O(logr)MediumDP
2463Minimum Total Distance TraveledC++PythonO(mlogm + nlogn + m * n)O(n)HardSort, DP, Prefix Sum, Mono Deque
2464Minimum Subarrays in a Valid SplitC++PythonO(n^2 * logr)O(n)Medium🔒DP
2466Count Ways To Build Good StringsC++PythonO(n)O(n)MediumDP
2470Number of Subarrays With LCM Equal to KC++PythonO(n * sqrt(k) * logk)O(sqrt(k))Mediumvariant ofNumber of Subarrays With GCD Equal to KDP
2470Number of Subarrays With LCM Equal to KC++PythonO(n * sqrt(k) * logk)O(sqrt(k))Mediumvariant ofNumber of Subarrays With GCD Equal to KDP
2475Number of Unequal Triplets in ArrayC++PythonO(n)O(n)EasyDP, Freq Table, Math
2478Number of Beautiful PartitionsC++PythonO(n * k)O(n)HardDP
2495Number of Subarrays Having Even ProductC++PythonO(n)O(1)Medium🔒DP, Math
2510Check if There is a Path With Equal Number of 0's And 1'sC++PythonO(m * n)O(n)Medium🔒DP
2518Number of Great PartitionsC++PythonO(n * k)O(k)HardKnapsack DP
2533Number of Good Binary StringsC++PythonO(n)O(w)Medium🔒DP
2538Difference Between Maximum and Minimum Price SumC++PythonO(n)O(n)HardDFS, Tree DP
2547Minimum Cost to Split an ArrayC++PythonO(n^2)O(n)HardDP
2552Count Increasing QuadrupletsC++PythonO(n^2)O(n)Hardvariant of132 PatternDP, Prefix Sum
2556Disconnect Path in a Binary Matrix by at Most One FlipC++PythonO(m * n)O(m + n)MediumDP, DFS
2565Subsequence With the Minimum ScoreC++PythonO(n)O(n)HardTwo Pointers, DP
2572Count the Number of Square-Free SubsetsC++PythonO(n + m * 2^p)O(m * 2^p)MediumNumber Theory, Combinatorics, Bitmasks, Memoization, DP


Greedy

#TitleSolutionTimeSpaceDifficultyTagNote
1005Maximize Sum Of Array After K NegationsC++PythonO(n) on averageO(1)EasyQuick Select
1024Video StitchingC++PythonO(nlogn)O(1)Mediumvariant ofJump Game II
1029Two City SchedulingC++PythonO(n) on averageO(1)EasyQuick Select
1053Previous Permutation With One SwapC++PythonO(n)O(1)Medium
1055Shortest Way to Form StringC++PythonO(m + n)O(m)Medium🔒, variant ofMinimum Window Subsequence
1058Minimize Rounding Error to Meet TargetC++PythonO(n) on averageO(n)Medium🔒Quick Select
1081Smallest Subsequence of Distinct CharactersC++PythonO(n)O(1)Mediumsame asRemove Duplicate LettersMono Stack
1090Largest Values From LabelsC++PythonO(nlogn)O(n)Medium
1111Maximum Nesting Depth of Two Valid Parentheses StringsC++PythonO(n)O(1)Medium
1163Last Substring in Lexicographical OrderC++PythonO(n)O(1)Hard
1167Minimum Cost to Connect SticksC++PythonO(nlogn)O(n)Medium🔒
1183Maximum Number of OnesC++PythonO(1)O(1)Hard🔒
1196How Many Apples Can You Put into the BasketC++PythonO(nlogn)O(n)Easy🔒
1199Minimum Time to Build BlocksC++PythonO(nlogn)O(n)Hard🔒
1221Split a String in Balanced StringsC++PythonO(n)O(1)Easy
1247Minimum Swaps to Make Strings EqualC++PythonO(n)O(1)Easy
1249Minimum Remove to Make Valid ParenthesesC++PythonO(n)O(1)MediumStack
1253Reconstruct a 2-Row Binary MatrixC++PythonO(n)O(1)Medium
1272Remove IntervalC++PythonO(n)O(1)MediumLine Sweep
1282Group the People Given the Group Size They Belong ToC++PythonO(n)O(n)Medium
1288Remove Covered IntervalsC++PythonO(nlogn)O(1)MediumLine Sweep
1296Divide Array in Sets of K Consecutive NumbersC++PythonO(nlogn)O(n)Medium
1326Minimum Number of Taps to Open to Water a GardenC++PythonO(n)O(n)Hardvariant ofJump Game II
1338Reduce Array Size to The HalfC++PythonO(n)O(n)MediumCounting Sort
1353Maximum Number of Events That Can Be AttendedC++PythonO(r + nlogn)O(n)MediumHeap, Sort
1354Construct Target Array With Multiple SumsC++PythonO(log(max(t)) * logn)O(n)HardHeap
1383Maximum Performance of a TeamC++PythonO(nlogn)O(n)Hardvariant ofMinimum Cost to Hire K WorkersGreedy, Heap
1386Cinema Seat AllocationC++PythonO(n)O(n)Medium
1400Construct K Palindrome StringsC++PythonO(n)O(1)Medium
1402Reducing DishesC++PythonO(nlogn)O(1)Hard
1403Minimum Subsequence in Non-Increasing OrderC++PythonO(nlogn)O(1)Easy
1405Longest Happy StringC++PythonO(n)O(1)Medium
1414Find the Minimum Number of Fibonacci Numbers Whose Sum Is KC++PythonO(logk)O(1)Medium
1419Minimum Number of Frogs CroakingC++PythonO(n)O(1)Medium
1433Check If a String Can Break Another StringC++PythonO(n)O(1)Medium
1488Avoid Flood in The CityC++PythonO(nlogn)O(n)Medium
1518Water BottlesC++PythonO(logn/logm)O(1)Easy
1520Maximum Number of Non-Overlapping SubstringsC++PythonO(n)O(1)Medium
1526Minimum Number of Increments on Subarrays to Form a Target ArrayC++PythonO(n)O(1)Hard
1536Minimum Swaps to Arrange a Binary GridC++PythonO(n^2)O(1)Medium
1546Maximum Number of Non-Overlapping Subarrays With Sum Equals TargetC++PythonO(n)O(n)Medium
1564Put Boxes Into the Warehouse IC++PythonO(nlogn)O(1)Medium🔒
1567Maximum Length of Subarray With Positive ProductC++PythonO(n)O(1)Medium
1568Minimum Number of Days to Disconnect IslandC++PythonO(m^2 * n^2)O(m * n)MediumDFS
1578Minimum Deletion Cost to Avoid Repeating LettersC++PythonO(n)O(1)Medium
1580Put Boxes Into the Warehouse IIC++PythonO(nlogn)O(1)Medium🔒
1585Check If String Is Transformable With Substring Sort OperationsC++PythonO(n)O(n)Hard
1589Maximum Sum Obtained of Any PermutationC++PythonO(nlogn)O(n)Medium
1591Strange Printer IIC++PythonO(c * m * n + e)O(e)Hard
1599Maximum Profit of Operating a Centennial WheelC++PythonO(n)O(1)Medium
1605Find Valid Matrix Given Row and Column SumsC++PythonO(m + n)O(1)Medium
1616Split Two Strings to Make PalindromeC++PythonO(n)O(1)MediumTwo Pointers
1632Rank Transform of a MatrixC++PythonO(m * n * log(m * n))O(m * n)HardUnion Find
1647Minimum Deletions to Make Character Frequencies UniqueC++PythonO(n)O(1)Medium
1653Minimum Deletions to Make String BalancedC++PythonO(n)O(1)Medium
1663Smallest String With A Given Numeric ValueC++PythonO(n)O(1)Medium
1665Minimum Initial Energy to Finish TasksC++PythonO(nlogn)O(1)Hard
1673Find the Most Competitive SubsequenceC++PythonO(n)O(k)MeidumStack, Greedy
1674Minimum Moves to Make Array ComplementaryC++PythonO(n + k)O(k)Meidum
1686Stone Game VIC++PythonO(nlogn)O(n)Medium
1689Partitioning Into Minimum Number Of Deci-Binary NumbersC++PythonO(n)O(1)Medium
1702Maximum Binary String After ChangeC++PythonO(n)O(1)Medium
1705Maximum Number of Eaten ApplesC++PythonO(nlogn)O(n)MediumHeap
1708Largest Subarray Length KC++PythonO(n)O(1)Easy🔒, variant ofLast Substring in Lexicographical Order
1710Maximum Units on a TruckC++PythonO(nlogn)O(1)Easy
1717Maximum Score From Removing SubstringsC++PythonO(n)O(1)Medium
1725Number Of Rectangles That Can Form The Largest SquareC++PythonO(n)O(1)Easy
1727Largest Submatrix With RearrangementsC++PythonO(m * nlogn)O(1)MediumSort
1733Minimum Number of People to TeachC++PythonO(n * m^2)O(n * m)Medium
1736Latest Time by Replacing Hidden DigitsC++PythonO(1)O(1)Easy
1737Change Minimum Characters to Satisfy One of Three ConditionsC++PythonO(m + n)O(1)MediumPrefix Sum
1749Maximum Absolute Sum of Any SubarrayC++PythonO(n)O(1)Mediumvariant ofMaximum SubarrayPrefix Sum
1754Largest Merge Of Two StringsC++PythonO(m * n)O(m + n)Medium
1758Minimum Changes To Make Alternating Binary StringC++PythonO(n)O(1)Easy
1759Count Number of Homogenous SubstringsC++PythonO(n)O(1)Medium
1762Buildings With an Ocean ViewC++PythonO(n)O(1)Medium🔒
1764Form Array by Concatenating Subarrays of Another ArrayC++PythonO(n)O(n)MediumKMP Algorithm
1769Minimum Number of Operations to Move All Balls to Each BoxC++PythonO(n)O(1)Medium
1775Equal Sum Arrays With Minimum Number of OperationsC++PythonO(m + n)O(1)Medium
1785Minimum Elements to Add to Form a Given SumC++PythonO(n)O(1)Medium
1788Maximize the Beauty of the GardenC++PythonO(n)O(n)Hard🔒
1793Maximum Score of a Good SubarrayC++PythonO(n)O(1)HardGreedy, Prefix Sum. Binary Search
1794Count Pairs of Equal Substrings With Minimum DifferenceC++PythonO(n)O(1)Medium🔒
1798Maximum Number of Consecutive Values You Can MakeC++PythonO(nlogn)O(1)Medium
1801Number of Orders in the BacklogC++PythonO(nlogn)O(n)MediumGreedy, Heap
1815Maximum Number of Groups Getting Fresh DonutsC++PythonO((b/2) * (n/(b/2)+1)^(b/2))O((n/(b/2)+1)^(b/2))HardGreedy, DP
1824Minimum Sideway JumpsC++PythonO(n)O(1)MediumGreedy, DP
1827Minimum Operations to Make the Array IncreasingC++PythonO(n)O(1)Easy
1833Maximum Ice Cream BarsC++PythonO(nlogn)O(1)Medium
1840Maximum Building HeightC++PythonO(nlogn)O(1)Hard
1842Next Palindrome Using Same DigitsC++PythonO(n)O(1)Hard🔒
1846Maximum Element After Decreasing and RearrangingC++PythonO(nlogn)O(1)Medium
1850Minimum Adjacent Swaps to Reach the Kth Smallest NumberC++PythonO((k + n) * n)O(n)Medium
1864Minimum Number of Swaps to Make the Binary String AlternatingC++PythonO(n)O(1)Medium
1874Minimize Product Sum of Two ArraysC++PythonO(nlogn)O(1)MediumGCJ2008 - Round 1A, 🔒
1877Minimize Maximum Pair Sum in ArrayC++PythonO(nlogn)O(1)Medium
1881Maximum Value after InsertionC++PythonO(n)O(1)Medium
1887Reduction Operations to Make the Array Elements EqualC++PythonO(nlogn)O(1)MediumSort
1893Check if All the Integers in a Range Are CoveredC++PythonO(n + r)O(r)EasyLine Sweep, Sort
1894Find the Student that Will Replace the ChalkC++PythonO(n)O(1)Medium
1897Redistribute Characters to Make All Strings EqualC++PythonO(n)O(1)Easy
1899Merge Triplets to Form Target TripletC++PythonO(n)O(1)Medium
1911Maximum Alternating Subsequence SumC++PythonO(n)O(1)Mediumvariant ofBest Time to Buy and Sell Stock II
1913Maximum Product Difference Between Two PairsC++PythonO(n)O(1)Medium
1921Eliminate Maximum Number of MonstersC++PythonO(nlogn)O(1)Medium
1927Sum GameC++PythonO(n)O(1)Medium
1936Add Minimum Number of RungsC++PythonO(n)O(1)Medium
1946Largest Number After Mutating SubstringC++PythonO(n)O(1)Medium
1953Maximum Number of Weeks for Which You Can WorkC++PythonO(n)O(1)Medium
1975Maximum Matrix SumC++PythonO(n^2)O(1)Medium
2027Minimum Moves to Convert StringC++PythonO(n)O(1)Easy
2030Smallest K-Length Subsequence With Occurrences of a LetterC++PythonO(n)O(n)HardMono Stack, Greedy
2036Maximum Alternating Subarray SumC++PythonO(n)O(1)Mediumvariant ofMaximum Alternating Subsequence Sum, 🔒Greedy,Kadane's Algorithm
2037Minimum Number of Moves to Seat EveryoneC++PythonO(nlogn)O(1)EasyGreedy
2071Maximum Number of Tasks You Can AssignC++PythonO(n * (logn)^2)O(n)HardGreedy, Binary Search, Sorted List
2086Minimum Number of Buckets Required to Collect Rainwater from HousesC++PythonO(n)O(1)MediumGreedy
2087Minimum Cost Homecoming of a Robot in a GridC++PythonO(m + n)O(1)MediumGreedy
2126Destroying AsteroidsC++PythonO(nlogn)O(1)MediumGreedy
2136Earliest Possible Day of Full BloomC++PythonO(nlogn)O(n)HardGreedy
2139Minimum Moves to Reach Target ScoreC++PythonO(logn)O(1)Medium
2141Maximum Running Time of N ComputersC++PythonO(nlogm)O(1)HardGreedy, Binary Search
2144Minimum Cost of Buying Candies With DiscountC++PythonO(nlogn)O(1)EasyGreedy, Sort
2147Number of Ways to Divide a Long CorridorC++PythonO(n)O(1)HardGreedy, Combinatorics
2160Minimum Sum of Four Digit Number After Splitting DigitsC++PythonO(1)O(1)EasyGreedy
2165Smallest Value of the Rearranged NumberC++PythonO(d)O(d)MediumGreedy, Counting Sort
2178Maximum Split of Positive Even IntegersC++PythonO(sqrt(n))O(1)MediumGreedy
2182Construct String With Repeat LimitC++PythonO(n)O(1)MediumGreedy
2193Minimum Number of Moves to Make PalindromeC++PythonO(nlogn)O(n)HardGreedy, BIT, Fenwick Tree
2195Append K Integers With Minimal SumC++PythonO(nlogn)O(n)MediumGreedy
2207Maximize Number of Subsequences in a StringC++PythonO(n)O(1)MediumCounting, Greedy
2214Minimum Health to Beat GameC++PythonO(n)O(1)Medium🔒Greedy
2216Minimum Deletions to Make Array BeautifulC++PythonO(n)O(1)MediumGreedy
2224Minimum Number of Operations to Convert TimeC++PythonO(1)O(1)EasyGreedy
2259Remove Digit From Number to Maximize ResultC++PythonO(n)O(1)EasyGreedy
2263Make Array Non-decreasing or Non-increasingC++PythonO(nlogn)O(n)Hard🔒DP, Greedy, Heap
2268Minimum Number of KeypressesC++PythonO(n)O(1)Medium🔒Greedy, Sort
2279Maximum Bags With Full Capacity of RocksC++PythonO(nlogn)O(1)MediumGreedy, Sort
2285Maximum Total Importance of RoadsC++PythonO(n)O(n)MediumGreedy, Counting Sort
2294Partition Array Such That Maximum Difference Is KC++PythonO(nlogn)O(1)MediumGreedy
2311Longest Binary Subsequence Less Than or Equal to KC++PythonO(n)O(1)MediumGreedy
2321Maximum Score Of Spliced ArrayC++PythonO(n)O(1)HardGreedy,Kadane's Algorithm
2323Find Minimum Time to Finish All Jobs IIC++PythonO(nlogn)O(1)Medium🔒Greedy
2340Minimum Adjacent Swaps to Make a Valid ArrayC++PythonO(n)O(1)Medium🔒Array, Greedy
2366Minimum Replacements to Sort the ArrayC++PythonO(n)O(1)HardGreedy, Math
2371Minimize Maximum Value in a GridC++PythonO((m * n) * log(m * n))O(m * n)Hard🔒Sort, Greedy
2375Construct Smallest Number From DI StringC++PythonO(n)O(1)MediumConstructive Algorithms, Greedy
2383Minimum Hours of Training to Win a CompetitionC++PythonO(n)O(1)EasyGreedy
2384Largest Palindromic NumberC++PythonO(n)O(1)MediumFreq Table, Greedy
2405Optimal Partition of StringC++PythonO(n)O(n)MediumGreedy, Hash Table
2410Maximum Matching of Players With TrainersC++PythonO(nlogn + mlogm)O(1)MediumGreedy, Sort
2412Minimum Money Required Before TransactionsC++PythonO(n)O(1)HardGreedy, Constructive Algorithms
2417Closest Fair IntegerC++PythonO(logn)O(logn)Medium🔒Constructive Algorithms, Greedy
2422Merge Operations to Turn Array Into a PalindromeC++PythonO(n)O(1)Medium🔒Constructive Algorithms, Greedy, Two Pointers
2434Using a Robot to Print the Lexicographically Smallest StringC++PythonO(n)O(n)MediumFreq Table, Greedy
2436Minimum Split Into Subarrays With GCD Greater Than OneC++PythonO(nlogr)O(1)Medium🔒Greedy
2439Minimize Maximum of ArrayC++PythonO(n)O(1)MediumGreedy
2440Create Components With Same ValueC++PythonO(n * sqrt(n))O(n)HardBFS, DFS, Greedy
2449Minimum Number of Operations to Make Arrays SimilarC++PythonO(nlogn)O(1)HardGreedy, Sort
2457Minimum Addition to Make Integer BeautifulC++PythonO(logn)O(1)MediumGreedy
2459Sort Array by Moving Items to Empty SpaceC++PythonO(n)O(n)Hard🔒Greedy, Sort
2472Maximum Number of Non-overlapping Palindrome SubstringsC++PythonO(n * k)O(1)HardTwo Pointers, Greedy
2479Maximum XOR of Two Non-Overlapping SubtreesC++PythonO(nlogr)O(n)Hard🔒, variant ofMaximum XOR of Two Numbers in an ArrayDFS, Trie, Greedy
2483Minimum Penalty for a ShopC++PythonO(n)O(1)MediumGreedy
2486Append Characters to String to Make SubsequenceC++PythonO(n)O(1)MediumTwo Pointers, Greedy
2498Frog Jump IIC++PythonO(n)O(1)MediumGreedy
2499Minimum Total Cost to Make Arrays UnequalC++PythonO(n)O(n)HardGreedy
2522Partition String Into Substrings With Values at Most KC++PythonO(n)O(1)MediumGreedy
2541Minimum Operations to Make Array Equal IIC++PythonO(n)O(1)MediumGreedy
2542Maximum Subsequence ScoreC++PythonO(nlogn)O(n)Mediumvariant ofMaximum Performance of a TeamGreedy, Heap
2548Maximum Price to Fill a BagC++PythonO(nlogn)O(1)Medium🔒Greedy, Sort
2551Put Marbles in BagsC++PythonO(n) on averageO(1)HardGreedy, Quick Select
2561Rearranging FruitsC++PythonO(n) on averageO(n)HardFreq Table, Greedy, Quick Select
2566Maximum Difference by Remapping a DigitC++PythonO(logn)O(1)EasyGreedy
2567Minimum Score by Changing Two ElementsC++PythonO(nlogn)O(1)MediumSort, Greedy
2571Minimum Operations to Reduce an Integer to 0C++PythonO(logn)O(1)MediumGreedy, Trick
2573Find the String with LCPC++PythonO(n^2)O(1)HardConstructive Algorithms, Greedy, DP


Graph

#TitleSolutionTimeSpaceDifficultyTagNote
1042Flower Planting With No AdjacentC++PythonO(n)O(n)Easy
1101The Earliest Moment When Everyone Become FriendsC++PythonO(nlogn)O(n)Medium🔒Union Find
1135Connecting Cities With Minimum CostC++PythonO(nlogn)O(n)Medium🔒Union Find,Kruskal's Algorithm, MST
1168Optimize Water Distribution in a VillageC++PythonO(nlogn)O(n)Hard🔒Union Find
1334Find the City With the Smallest Number of Neighbors at a Threshold DistanceC++PythonO(n^3)O(n^2)MediumFloyd-Warshall Algorithm
1349Maximum Students Taking ExamC++PythonO(m * n * sqrt(m * n))O(m + n)HardGCJ2008 - Round 3Hopcroft-Karp Bipartite Matching,Hungarian Bipartite Matching, Maximum Independent Set
1361Validate Binary Tree NodesC++PythonO(n)O(n)MediumDFS, Tree
1462Course Schedule IVC++PythonO(n^3)O(n^2)MediumFloyd-Warshall Algorithm
1489Find Critical and Pseudo-Critical Edges in Minimum Spanning TreeC++PythonO(nlogn)O(n)HardKruskal Algorithm
1557Minimum Number of Vertices to Reach All NodesC++PythonO(e)O(n)Medium
1579Remove Max Number of Edges to Keep Graph Fully TraversableC++PythonO(n + m)O(n)HardUnion Find
1584Min Cost to Connect All PointsC++PythonO(n^2)O(n)MediumUnion Find,Kruskal's Algorithm, MST
1601Maximum Number of Achievable Transfer RequestsC++PythonO((n + r) * 2^r)O(n + r)HardCombinations, Backtracking
1615Maximal Network RankC++PythonO(m + n + k^2)O(m + n)MediumCounting Sort
1627Graph Connectivity With ThresholdC++PythonO(nlogn + q)O(n)HardUnion Find, Math
1631Path With Minimum EffortC++PythonO(m * n * log(m * n))O(m * n)MediumBinary Search, DFS, BFS, Bi-BFS, Union Find,Dijkstra's Algorithm
1697Checking Existence of Edge Length Limited PathsC++PythonO(nlogn + mlogm)O(n)HardUnion Find
1719Number Of Ways To Reconstruct A TreeC++PythonO(nlogn)O(n)Hard
1724Checking Existence of Edge Length Limited Paths IIC++Pythonctor:O(nlogn + mlogm)
query:O(logn)
O(nlogn + m)Hard🔒Versioned Union Find, Binary Lifting
1743Restore the Array From Adjacent PairsC++PythonO(n)O(n)Medium
1761Minimum Degree of a Connected Trio in a GraphC++PythonO(n^3)O(n^2)Hard
1778Shortest Path in a Hidden GridC++PythonO(m * n)O(m * n)Medium🔒DFS, BFS, Bi-BFS
1782Count Pairs Of NodesC++PythonO(n + e + q)O(n + e)HardCounting, Two Pointers
1786Number of Restricted Paths From First to Last NodeC++PythonO(|E| * log|V|)O(|E|)MediumDijkstra's Algorithm, DP
1791Find Center of Star GraphC++PythonO(n)O(n)Medium
1810Minimum Path Cost in a Hidden GridC++PythonO(m * n * log(m * n))O(m * n)Medium🔒DFS,Dijkstra's Algorithm
1820Maximum Number of Accepted InvitationsC++PythonO(m * n * sqrt(m + n))O(m + n)Medium🔒Hopcroft-Karp Bipartite Matching,Hungarian Bipartite Matching
1879Minimum XOR Sum of Two ArraysC++PythonO(n^3)O(n^2)HardDP,Hungarian Weighted Bipartite Matching
1947Maximum Compatibility Score SumC++PythonO(m^2 * (n + m))O(m^2)Mediumvariant ofMinimum XOR Sum of Two ArraysDP,Hungarian Weighted Bipartite Matching
1971Find if Path Exists in GraphC++PythonO(|V| + |E|)O(|V| + |E|)EasyDFS, BFS, Bi-BFS
1976Number of Ways to Arrive at DestinationC++PythonO(|E| * log|V|)O(|E|)MediumDijkstra's Algorithm
2076Process Restricted Friend RequestsC++PythonO(n * r)O(n)HardUnion Find
2077Paths in Maze That Lead to Same RoomC++PythonO(|V|^3)O(|E|)Medium🔒
2092Find All People With SecretC++PythonO(nlogn)O(nlogn)HardBFS, DFS, Union Find
2093Minimum Path Cost in a Hidden GridC++PythonO(|E| * log|V|)O(|V| + |E|)Mediumvariant ofCheapest Flights Within K Stops, 🔒Dijkstra's Algorithm, DP
2097Valid Arrangement of PairsC++PythonO(|V| + |E|)O(|V| + |E|)Hardvariant ofReconstruct ItineraryHierholzer's Algorithm, Eulerian Path
2123Minimum Operations to Remove Adjacent Ones in MatrixC++PythonO(m * n * sqrt(m * n))O(m + n)Hardvariant ofMaximum Students Taking Exam, 🔒Hopcroft-Karp Bipartite Matching, Maximum Independent Set
2127Maximum Employees to Be Invited to a MeetingC++PythonO(n)O(n)Hard
2172Maximum AND Sum of ArrayC++PythonO(n^3)O(n^2)Hardvariant ofMaximum Compatibility Score SumDP,Hungarian Weighted Bipartite Matching
2203Minimum Weighted Subgraph With the Required PathsC++PythonO(|E| * log|V|)O(|E|)HardDijkstra's Algorithm
2204Distance to a Cycle in Undirected GraphC++PythonO(|V| + |E|)O(|V| + |E|)Hard🔒Graph, DFS, BFS
2242Maximum Score of a Node SequenceC++PythonO(|V| + |E|)O(|V|)HardGraph
2307Check for Contradictions in EquationsC++PythonO(e + q)O(n)Hard🔒, variant ofEvaluate DivisionDFS, Union Find
2359Find Closest Node to Given Two NodesC++PythonO(n)O(n)MediumGraph, Hash Table, DFS
2360Longest Cycle in a GraphC++PythonO(n)O(n)HardGraph, Hash Table, DFS
2392Build a Matrix With ConditionsC++PythonO(k^2 + r + c)O(k + r + c)HardGraph, Topological Sort
2473Minimum Cost to Buy ApplesC++PythonO(n * rlogn)O(n)Medium🔒Dijkstra's Algorithm
2508Add Edges to Make Degrees of All Nodes EvenC++PythonO(n)O(n)HardGraph


Geometry

#TitleSolutionTimeSpaceDifficultyTagNote
1453Maximum Number of Darts Inside of a Circular DartboardC++PythonO(n^2 * logn)O(n)HardLine Sweep
1515Best Position for a Service CentreC++PythonO(n * iter)O(n)HardGeometric Median, Gradient Descent, Weiszfeld's Algorithm
1610Maximum Number of Visible PointsC++PythonO(nlogn)O(n)HardTwo Pointers, Sliding Window
1924Erect the Fence IIC++PythonO(n) on averageO(n)Hard🔒Welzl's Algorithm
1956Minimum Time For K Virus Variants to SpreadC++PythonO(nlogn * logr)O(n)Hard🔒Geometry, Binary Search, Line Sweep, Segment Tree, Coordinate Compression
2101Detonate the Maximum BombsC++PythonO(|V|^2 + \V| * |E|)O(\V| + |E|)MediumGraph, DFS, BFS


Simulation

#TitleSolutionTimeSpaceDifficultyTagNote
1138Alphabet Board PathC++PythonO(n)O(1)Medium
1243Array TransformationC++PythonO(n^2)O(n)Easy
2061Number of Spaces Cleaning Robot CleanedC++PythonO(m * n)O(1)Medium🔒
2162Minimum Cost to Set Cooking TimeC++PythonO(1)O(1)Medium
2257Count Unguarded Cells in the GridC++PythonO(m * n)O(m * n)MediumArray, Simulation
2303Calculate Amount Paid in TaxesC++PythonO(n)O(1)EasySimulation
2507Smallest Value After Replacing With Sum of Prime FactorsC++PythonO(s * logn)O(max_n^0.5)MediumNumber Theory, Simulation
2532Time to Cross a BridgeC++PythonO(k + nlogk)O(k)HardHeap, Simulation
2534Time Taken to Cross the DoorC++PythonO(n)O(n)Hard🔒Queue, Simulation


Design

#TitleSolutionTimeSpaceDifficultyTagNote
1146Snapshot ArrayC++Pythonset:O(1)
get:O(logn)
O(n)Medium
1166Design File SystemC++Pythoncreate:O(n)
get:O(n)
O(n)Medium🔒
1172Dinner Plate StacksC++Pythonpush:O(logn)
pop:O(1), amortized
popAtStack:(logn)
O(n * c)Hard
1206Design SkiplistC++PythonO(logn), on averageO(n)Hard
1236Web CrawlerC++PythonO(|V| + |E|)O(|V|)Medium🔒BFS, DFS
1244Design A LeaderboardC++Pythonctor:O(1)
add:O(1)
top:O(n)
reset:O(1)
O(n)Medium
1268Search Suggestions SystemC++Pythonctor:O(n * l)
suggest:O(l^2)
O(t)MediumTrie
1286Iterator for CombinationC++PythonO(k)O(k)MediumStack
1348Tweet Counts Per FrequencyC++Pythonadd:O(logn)
query:O(c)
O(n)Medium
1352Product of the Last K NumbersC++Pythonctor:O(1)
add:O(1)
get:O(1)
O(n)Medium
1357Apply Discount Every n OrdersC++Pythonctor:O(m)
getBill:O(p)
O(m)Medium
1381Design a Stack With Increment OperationC++Pythonctor:O(1)
push:O(1)
pop:O(1)
increment:O(1)
O(n)Medium
1396Design Underground SystemC++Pythonctor:O(1)
checkin:O(1)
checkout:O(1)
getaverage:O(1)
O(n)Medium
1429First Unique NumberC++Pythonctor:O(k)
add:O(1)
showFirstUnique:O(1)
O(n)Medium🔒LinkedHashSet
1472Design Browser HistoryC++Pythonctor:O(1)
visit:O(1)
back:O(1)
forward:O(1)
O(n)Medium
1476Subrectangle QueriesC++Pythonctor:O(1)
update:O(1)
get:O(u)
O(u)Medium
1483Kth Ancestor of a Tree NodeC++Pythonctor:O(n * logh)
get:O(logh)
O(n * logh)HardDP, Binary Lifting
1500Design a File Sharing SystemC++Pythonctor:O(1)
join:O(logu + c)
leave:O(logu + c)
request:O(u)
O(u * c)Medium🔒
1570Dot Product of Two Sparse VectorsC++Pythonctor:O(n)
dot_product:O(min(n, m))
O(n)Medium🔒
1586Binary Search Tree Iterator IIC++PythonO(1), amortizedO(h)Medium🔒
1600Throne InheritanceC++Pythonctor:O(1)
birth:O(1)
death:O(1)
inherit:O(n)
O(n)Medium
1603Design Parking SystemC++PythonO(1)O(1)Easy
1622Fancy SequenceC++PythonO(1)O(n)HardEuler's Theorem
1628Design an Expression Tree With Evaluate FunctionC++PythonO(n)O(h)Medium🔒
1656Design an Ordered StreamC++PythonO(1), amortizedO(n)Easy
1670Design Front Middle Back QueueC++PythonO(1)O(n)Medium
1756Design Most Recently Used QueueC++Pythonctor:O(nlogn)
fetch:O(logn)
O(n)Medium🔒Sorted List, BIT, Fenwick Tree, Square Root Decomposition
1797Design Authentication ManagerC++Pythonctor:O(1)
generate:O(1), amortized
renew:O(1), amortized
count:O(1), amortized
O(n)MediumOrderedDict
1804Implement Trie II (Prefix Tree)C++Pythonctor:O(1)
insert:O(n)
count_word:O(n)
count_prefix:O(n)
erase:O(n)
O(t)Medium🔒Trie
1825Finding MK AverageC++Pythonctor:O(1)
add_element:O(logn)
calc_mkaverge:O(1)
O(m)HardSorted List
1845Seat Reservation ManagerC++Pythonctor:O(n)
reserve:O(logn)
unreserve:O(logn)
O(n)MediumHeap
1865Finding Pairs With a Certain SumC++Pythonctor:O(n1 + n2)
add:O(1)
count:O(n1)
O(n1 + n2)MediumHash Table
1912Design Movie Rental SystemC++Pythonctor:O(nlogn)
search:O(logn)
rent:O(logn)
drop:O(logn)
report:O(logn)
O(n)HardOrdered List
1993Operations on TreeC++Pythonctor:O(n)
lock:O(1)
unlock:O(1)
upgrade:O(n)
O(n)Medium
2013Detect SquaresC++Pythonctor:O(1)
add:O(1)
count:O(n)
O(n)Medium
2034Stock Price FluctuationC++Pythonctor:O(1)
update:O(logn)
current:O(1)
max:O(1)
min:O(1)
O(n)MediumSorted List, Heap
2043Simple Bank SystemC++Pythonctor:O(1)
transer:O(1)
deposit:O(1)
withdraw:O(1)
O(1)Medium
2069Walking Robot Simulation IIC++PythonO(1)O(1)MediumSimulation, Math
2080Range Frequency QueriesC++Pythonctor:O(n)
query:O(logn)
O(n)MediumBinary Search
2102Sequentially Ordinal Rank TrackerC++Pythonadd:O(logn)
get:O(logn)
O(n)HardSorted List
2166Design BitsetC++Pythonctor: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
2227Encrypt and Decrypt StringsC++Pythonctor:O(m + d)
encrypt:O(n)
decrypt:O(n)
O(n)HardFreq Table
2241Design an ATM MachineC++Pythonctor:O(1)
deposit:O(1)
withdraw:O(1)
O(1)MediumGreedy
2254Design Video Sharing PlatformC++Pythonctor:O(1)
upload:O(logn + l)
remove:O(logn)
like:O(1)
dislike:O(1)
view:O(1)
getLikesAndDislikes:O(1)
getViews:O(1)
O(n * l)Hard🔒Heap
2276Count Integers in IntervalsC++Pythonctor:O(1)
add:O(logn), amortized
Count:O(1)
O(n)HardSorted List
2286Booking Concert Tickets in GroupsC++Pythonctor:O(n)
gather:O(logn)
scatter:O(logn), amortized
O(n)HardSegment Tree, Binary Search
2296Design a Text EditorC++Pythonctor:O(1)
addText:O(l)
deleteText:O(k)
cursorLeft:O(k)
cursorRight:O(k)
O(n)HardStack
2336Smallest Number in Infinite SetC++Pythonctor:O(1)
popSmallest:O(logn)
addBack:O(logn)
O(n)MediumHeap, BST
2349Design a Number Container SystemC++Pythonctor:O(1)
change:O(logn)
find:O(1)
O(n)MediumSorted List, BST
2353Design a Food Rating SystemC++Pythonctor:O(nlogn)
changeRating:O(logn)
highestRated:O(1)
O(n)MediumSorted List, BST
2408Design SQLC++Pythonctor:O(t * max_m)
insertRow:O(m)
deleteRow:O(1)
selectCell:O(m)
O(d)Medium🔒Hash Table
2424Longest Uploaded PrefixC++Pythonctor:O(1)
upload:O(1), amortized
longest:O(1)
O(n)MediumHash Table
2502Design Memory AllocatorC++Pythonctor:O(1)
allocate:O(logn)
free:O(logn)
O(n)MediumSorted List
2526Find Consecutive Integers from a Data StreamC++PythonO(1)O(1)MediumArray


Concurrency

#TitleSolutionTimeSpaceDifficultyTagNote
1114Print in OrderC++PythonO(n)O(1)Easy
1115Print FooBar AlternatelyC++PythonO(n)O(1)Medium
1116Print Zero Even OddC++PythonO(n)O(1)Medium
1117Building H2OC++PythonO(n)O(1)Hard
1188Design Bounded Blocking QueueC++PythonO(n)O(1)Medium🔒
1195Fizz Buzz MultithreadedC++PythonO(n)O(1)Medium
1226The Dining PhilosophersC++PythonO(n)O(1)Medium
1242Web Crawler MultithreadedC++PythonO(|V| + |E|)O(|V|)Medium🔒
1279Traffic Light Controlled IntersectionC++PythonO(n)O(1)Easy🔒


SQL

#TitleSolutionTimeSpaceDifficultyTagNote
1045Customers Who Bought All ProductsMySQLO(n + k)O(n + k)Medium🔒
1050Actors and Directors Who Cooperated At Least Three TimesMySQLO(n)O(n)Easy🔒
1068Product Sales Analysis IMySQLO(m + n)O(m + n)Easy🔒
1069Product Sales Analysis IIMySQLO(n)O(n)Easy🔒
1070Product Sales Analysis IIIMySQLO(n)O(n)Medium🔒
1075Project Employees IMySQLO(m + n)O(m + n)Easy🔒
1076Project Employees IIMySQLO(n)O(n)Easy🔒
1077Project Employees IIIMySQLO((m + n)^2)O(m + n)Medium🔒
1082Sales Analysis IMySQLO(n)O(n)Easy🔒
1083Sales Analysis IIMySQLO(m + n)O(m + n)Easy🔒
1084Sales Analysis IIIMySQLO(m + n)O(m + n)Easy🔒
1097Game Play Analysis VMySQLO(n^2)O(n)Hard🔒
1098Unpopular BooksMySQLO(m + n)O(n)Medium🔒
1107New Users Daily CountMySQLO(n)O(n)Medium🔒
1112Highest Grade For Each StudentMySQLO(nlogn)O(n)Medium🔒
1113Reported PostsMySQLO(n)O(n)Easy🔒
1126Active BusinessesMySQLO(n)O(n)Medium🔒
1127User Purchase PlatformMySQLO(n)O(n)Hard🔒
1132Reported Posts IIMySQLO(m + n)O(n)Medium🔒
1141User Activity for the Past 30 Days IMySQLO(n)O(n)Easy🔒
1142User Activity for the Past 30 Days IIMySQLO(n)O(n)Easy🔒
1148Article Views IMySQLO(nlogn)O(n)Easy🔒
1149Article Views IIMySQLO(nlogn)O(n)Medium🔒
1158Market Analysis IMySQLO(m + n)O(m + n)Medium🔒
1159Market Analysis IIMySQLO(m + n)O(m + n)Hard🔒
1164Product Price at a Given DateMySQLO(mlogn)O(m)Medium🔒
1173Immediate Food Delivery IMySQLO(n)O(1)Easy🔒
1174Immediate Food Delivery IIMySQLO(n)O(m)Medium🔒
1179Reformat Department TableMySQLO(n)O(n)Easy🔒
1193Monthly Transactions IMySQLO(n)O(n)Medium🔒
1194Tournament WinnersMySQLO(m + n + nlogn)O(m + n)Hard🔒
1204Last Person to Fit in the ElevatorMySQLO(nlogn)O(n)Medium🔒
1205Monthly Transactions IIMySQLO(n)O(n)Medium🔒
1211Queries Quality and PercentageMySQLO(n)O(n)Easy
1212Team Scores in Football TournamentMySQLO(nlogn)O(n)Medium
1225Report Contiguous DatesMySQLO(nlogn)O(n)Hard🔒
1241Number of Comments per PostMySQLO(n)O(n)Easy🔒
1251Average Selling PriceMySQLO(n)O(n)Easy🔒
1264Page RecommendationsMySQLO(m + n)O(m)Medium🔒
1270All People Report to the Given ManagerMySQLO(n)O(n)Medium🔒
1280Students and ExaminationsMySQLO((m * n) * log(m * n))O(m * n)Easy🔒
1285Find the Start and End Number of Continuous RangesMySQLO(n)O(n)Medium🔒
1294Weather Type in Each CountryMySQLO(m + n)O(n)Easy🔒
1303Find the Team SizeMySQLO(n)O(n)Easy🔒
1308Running Total for Different GendersMySQLO(nlogn)O(n)Medium🔒
1321Restaurant GrowthMySQLO(nlogn)O(n)Medium🔒
1322Ads PerformanceMySQLO(nlogn)O(n)Easy🔒
1327List the Products Ordered in a PeriodMySQLO(n)O(n)Easy🔒
1336Number of Transactions per VisitMySQLO(m + n)O(m + n)Medium🔒
1341Movie RatingMySQLO(nlogn)O(n)Medium🔒
1350Students With Invalid DepartmentsMySQLO(n)O(n)Easy🔒
1355Activity ParticipantsMySQLO(n)O(n)Medium🔒
1364Number of Trusted Contacts of a CustomerMySQLO(n + m + l + nlogn)O(n + m + l)Medium🔒
1369Get the Second Most Recent ActivityMySQLO(nlogn)O(n)Hard🔒
1378Replace Employee ID With The Unique IdentifierMySQLO(n)O(n)Easy🔒
1384Total Sales Amount by YearMySQLO(nlogn)O(n)Hard🔒
1393Capital Gain/LossMySQLO(n)O(n)Medium🔒
1398Customers Who Bought Products A and B but Not CMySQLO(m + n)O(m + n)Medium🔒
1407Top TravellersMySQLO(m + nlogn)O(m + n)Easy🔒
1412Find the Quiet Students in All ExamsMySQLO(m + nlogn)O(m + n)Hard🔒
1421NPV QueriesMySQLO(n)O(n)Medium🔒
1435Create a Session Bar ChartMySQLO(n)O(1)Easy🔒
1440Evaluate Boolean ExpressionMySQLO(n)O(n)Medium🔒
1445Apples & OrangesMySQLO(n)O(n)Medium🔒
1454Active UsersMySQLO(nlogn)O(n)Medium🔒
1459Rectangles AreaMySQLO(n^2)O(n^2)Medium🔒
1468Calculate SalariesMySQLO(m + n)O(m + n)Easy🔒
1479Sales by Day of the WeekMySQLO(m + n)O(n)Hard🔒
1484Group Sold Products By The DateMySQLO(nlogn)O(n)Easy🔒
1495Friendly Movies Streamed Last MonthMySQLO(n)O(n)Easy🔒
1501Countries You Can Safely Invest InMySQLO(n)O(n)Medium🔒
1511Customer Order FrequencyMySQLO(n)O(n)Easy🔒
1517Find Users With Valid E-MailsMySQLO(n)O(n)Easy🔒Regex
1527Patients With a ConditionMySQLO(n)O(n)Easy🔒Regex
1532The Most Recent Three OrdersMySQLO(nlogn)O(n)Medium🔒
1543Fix Product Name FormatMySQLO(nlogn)O(n)Easy🔒
1549The Most Recent Orders for Each ProductMySQLO(nlogn)O(n)Medium🔒
1555Bank Account SummaryMySQLO(m + n)O(m + n)Medium🔒
1565Unique Orders and Customers Per MonthMySQLO(n)O(n)Easy🔒
1571Warehouse ManagerMySQLO(n)O(n)Medium🔒
1581Customer Who Visited but Did Not Make Any TransactionsMySQLO(n)O(n)Easy🔒
1587Bank Account Summary IIMySQLO(m + n)O(m + n)Easy🔒
1596The Most Frequently Ordered Products for Each CustomerMySQLO(n)O(n)Medium🔒
1607Sellers With No SalesMySQLO(nlogm)O(n + m)Medium🔒
1613Find the Missing IDsMySQLO(n^2)O(n)Medium🔒
1623All Valid Triplets That Can Represent a CountryMySQLO(n^3)O(n^3)Easy🔒
1633Percentage of Users Attended a ContestMySQLO(m + nlogn)O(n)Easy🔒
1635Hopper Company Queries IMySQLO(d + r + tlogt)O(d + r + t)Hard🔒
1645Hopper Company Queries IIMySQLO(d + r + tlogt)O(d + r + t)Hard🔒
1651Hopper Company Queries IIIMySQLO(d + r + tlogt)O(d + r + t)Hard🔒
1661Average Time of Process per MachineMySQLO(n)O(n)Easy🔒
1667Fix Names in a TableMySQLO(nlogn)O(n)Easy🔒
1677Product's Worth Over InvoicesMySQLO(nlogn)O(n)Easy🔒
1683Invalid TweetsMySQLO(n)O(n)Easy🔒
1693Daily Leads and PartnersMySQLO(n)O(n)Easy🔒
1699Number of Calls Between Two PersonsMySQLO(n)O(n)Medium🔒
1709Biggest Window Between VisitsMySQLO(nlogn)O(n)Medium🔒
1715Count Apples and OrangesMySQLO(n)O(n)Medium🔒
1729Find Followers CountMySQLO(nlogn)O(n)Easy🔒
1731The Number of Employees Which Report to Each EmployeeMySQLO(nlogn)O(n)Easy🔒
1741Find Total Time Spent by Each EmployeeMySQLO(nlogn)O(n)Easy🔒
1747Leetflex Banned AccountsMySQLO(n^2)O(n)Medium🔒
1757Recyclable and Low Fat ProductsMySQLO(n)O(n)Easy🔒
1767Find the Subtasks That Did Not ExecuteMySQLO(n * c)O(n * c)Hard🔒
1777Product's Price for Each StoreMySQLO(n)O(n)Easy🔒
1783Grand Slam TitlesMySQLO(n)O(n)Medium🔒
1789Primary Department for Each EmployeeMySQLO(n)O(n)Easy🔒
1795Rearrange Products TableMySQLO(n)O(n)Easy🔒
1809Ad-Free SessionsMySQLO(n)O(n)Easy🔒
1811Find Interview CandidatesMySQLO(nlogn)O(n)Medium🔒
1821Find Customers With Positive Revenue this YearMySQLO(n)O(n)Easy🔒
1831Maximum Transaction Each DayMySQLO(nlogn)O(n)Medium🔒
1841League StatisticsMySQLO(nlogn)O(n)Medium🔒
1843Suspicious Bank AccountsMySQLO(nlogn)O(n)Medium🔒
1853Convert Date FormatMySQLO(n)O(n)Easy🔒
1867Orders With Maximum Quantity Above AverageMySQLO(n)O(n)Easy🔒
1873Calculate Special BonusMySQLO(n)O(n)Easy🔒
1875Group Employees of the Same SalaryMySQLO(nlogn)O(n)Medium🔒
1890The Latest Login in 2020MySQLO(n)O(n)Easy🔒
1892Page Recommendations IIMySQLO(n * m)O(n * m)Hard🔒
1907Count Salary CategoriesMySQLO(n)O(n)Medium🔒
1917Leetcodify Friends RecommendationsMySQLO(n^2)O(n^2)Hard🔒
1919Leetcodify Similar FriendsMySQLO(n * l)O(n * l)Hard🔒
1934Confirmation RateMySQLO(n + m)O(n + m)Medium🔒
1939Users That Actively Request Confirmation MessagesMySQLO(nlogn)O(n)Easy🔒
1949Strong FriendshipMySQLO(n^3)O(n^2)Medium🔒
1951All the Pairs With the Maximum Number of Common FollowersMySQLO(n^3)O(n^2)Medium🔒
1965Employees With Missing InformationMySQLO(nlogn)O(n)Easy🔒
1972First and Last Call On the Same DayMySQLO(n)O(n)Hard🔒
1978Employees Whose Manager Left the CompanyMySQLO(nlogn)O(n)Easy🔒
1988Find Cutoff Score for Each SchoolMySQLO(n * m)O(n * m)Medium🔒
1990Count the Number of ExperimentsMySQLO(n)O(n)Easy🔒
2004The Number of Seniors and Juniors to Join the CompanyMySQLO(nlogn)O(n)Hard🔒
2010The Number of Seniors and Juniors to Join the Company IIMySQLO(nlogn)O(n)Hard🔒
2020Number of Accounts That Did Not StreamMySQLO(m + n)O(m + n)Medium🔒
2026Low-Quality ProblemsMySQLO(nlogn)O(n)Easy🔒
2041Accepted Candidates From the InterviewsMySQLO(m + n)O(m + n)Medium🔒
2051The Category of Each Member in the StoreMySQLO(m + n)O(m + n)Medium🔒
2066Account BalanceMySQLO(nlogn)O(n)Medium🔒
2072The Winner UniversityMySQLO(n)O(n)Easy🔒
2082The Number of Rich CustomersMySQLO(n)O(n)Easy🔒
2084Drop Type 1 Orders for Customers With Type 0 OrdersMySQLO(nlogn)O(n)Medium🔒
2112The Airport With the Most TrafficMySQLO(n)O(n)Medium🔒
2118Build the EquationMySQLO(nlogn)O(n)Hard🔒
2142The Number of Passengers in Each Bus IMySQLO(p * b + blogb)O(p * b)Medium🔒
2153The Number of Passengers in Each Bus IIMySQLO(p * b + blogb)O(p * b)Hard🔒
2159Order Two Columns IndependentlyMySQLO(nlogn)O(n)Medium🔒
2173Longest Winning StreakMySQLO(nlogn)O(n)Hard🔒
2175The Change in Global RankingsMySQLO(nlogn)O(n)Medium🔒
2199Finding the Topic of Each PostMySQLO(n * mlogm)O(n * m)Hard🔒
2205The Number of Users That Are Eligible for DiscountMySQLO(n)O(n)Easy🔒
2228Users With Two Purchases Within Seven DaysMySQLO(nlogn)O(n)Medium🔒
2230The Users That Are Eligible for DiscountMySQLO(nlogn)O(n)Easy🔒
2238Number of Times a Driver Was a PassengerMySQLO(n)O(n)Medium🔒
2252Dynamic Pivoting of a TableMySQLO(n * m)O(n * m)Hard🔒
2253Dynamic Unpivoting of a TableMySQLO(n * m)O(n * m)Hard🔒
2292Products With Three or More Orders in Two Consecutive YearsMySQLO(nlogn)O(n)Medium🔒
2298Tasks Count in the WeekendMySQLO(n)O(n)Medium🔒
2308Arrange Table by GenderMySQLO(nlogn)O(n)Medium🔒
2314The First Day of the Maximum Recorded Degree in Each CityMySQLO(nlogn)O(n)Medium🔒
2324Product Sales Analysis IVMySQLO(nlogn)O(n)Medium🔒
2329Product Sales Analysis VMySQLO(nlogn)O(n)Medium🔒
2339All the Matches of the LeagueMySQLO(n^2)O(n^2)Easy🔒
2346Compute the Rank as a PercentageMySQLO(nlogn)O(n)Medium🔒
2356Number of Unique Subjects Taught by Each TeacherMySQLO(n)O(n)Easy🔒
2362Generate the InvoiceMySQLO(m + nlogn)O(n + m)Hard🔒
2372Calculate the Influence of Each SalespersonMySQLO(sp + c + s)O(sp + c + s)Medium🔒
2377Sort the Olympic TableMySQLO(nlogn)O(n)Easy🔒
2388Change Null Values in a Table to the Previous ValueMySQLO(nlogn)O(n)Medium🔒
2394Employees With DeductionsMySQLO(n)O(n)Medium🔒
2474Customers With Strictly Increasing PurchasesMySQLO(n)O(n)Hard🔒
2480Form a Chemical BondMySQLO(n^2)O(n)Easy🔒
2494Merge Overlapping Events in the Same HallMySQLO(nlogn)O(n)Hard🔒
2504Concatenate the Name and the ProfessionMySQLO(nlogn)O(n)Easy🔒


Shell Script

#TitleSolutionTimeSpaceDifficultyTagNote


About

🏋️ Python / Modern C++ Solutions of All 2573 LeetCode Problems (Weekly Update)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++54.3%
  • Python45.5%
  • Java0.2%
  • Go0.0%
  • Shell0.0%
  • C#0.0%

[8]ページ先頭

©2009-2025 Movatter.jp