Medium Problems
1423 problems
This track helps you build stable solving and explanation quality at this pressure level.
Training Focus
Focus on pattern recognition and trade-off clarity.
Cadence
Run 3-5 problems per round: explain, implement, then review failure paths.
Pair With
Pair this track with topic and pattern pages for faster transfer learning.
Add Two Numbers
Add Two Numbers requires careful linked-list pointer manipulation to sum digits while handling carries efficiently in in…
Longest Substring Without Repeating Characters
Find the length of the longest substring without repeating characters using a sliding window and hash map to track state…
Longest Palindromic Substring
Find the longest contiguous palindromic substring in a given string using dynamic programming and two-pointer expansion …
Zigzag Conversion
Convert a string into a zigzag pattern across multiple rows and read it line by line efficiently for string manipulation…
Reverse Integer
Reverse Integer challenges you to invert the digits of a signed 32-bit integer, handling overflow and negative values ca…
String to Integer (atoi)
Convert a string to a 32-bit signed integer by carefully parsing characters, handling signs, and ignoring invalid traili…
Container With Most Water
Find two vertical lines that can form a container with the most water in a given array of heights.
Integer to Roman
Convert a given integer to its Roman numeral representation using hash table mapping and decimal place math operations e…
3Sum
Given an integer array, return all unique triplets where the sum is zero using two-pointer scanning with careful duplica…
3Sum Closest
Find the sum of three integers in an array that is closest to a given target using two-pointer scanning.
Letter Combinations of a Phone Number
Generate all letter combinations a digit string can represent using backtracking with pruning, leveraging hash table map…
4Sum
The 4Sum problem requires finding all unique quadruplets in an array that sum to a specific target value.
Remove Nth Node From End of List
Remove the nth node from the end of a linked list using a two-pointer approach to solve efficiently.
Generate Parentheses
Generate Parentheses requires generating all valid combinations of parentheses with given pairs using backtracking and s…
Swap Nodes in Pairs
Learn how to swap every adjacent linked-list pair by rewiring nodes safely without changing values or breaking the remai…
Divide Two Integers
Solve Divide Two Integers by turning repeated subtraction into bit-shifted chunk subtraction with careful sign and overf…
Next Permutation
Next Permutation is a medium-difficulty problem focusing on generating the next lexicographically greater permutation of…
Search in Rotated Sorted Array
Find the index of a target in a rotated sorted array using a careful binary search that handles pivot shifts.
Find First and Last Position of Element in Sorted Array
Locate the first and last index of a target in a sorted array using binary search for precise O(log n) performance.
Valid Sudoku
Check if a 9x9 Sudoku board is valid by scanning rows, columns, and sub-boxes with hash lookups, ensuring no duplicates …
Count and Say
Count and Say requires building the nth sequence term by iteratively applying a run-length encoding on strings of digits…
Combination Sum
Find all unique combinations of numbers from a distinct array that sum to a target using controlled backtracking search.
Combination Sum II
Find all unique combinations of numbers that sum to a target using backtracking with careful pruning to avoid duplicates…
Multiply Strings
Multiply Strings requires simulating integer multiplication using only string operations without direct numeric conversi…
Jump Game II
Jump Game II requires finding the minimum jumps to reach the end of an array using dynamic programming and greedy techni…
Permutations
Generate all possible orderings of a distinct integer array using backtracking search with careful pruning to avoid dupl…
Permutations II
Generate all unique permutations of an array containing duplicates using backtracking and pruning to avoid repeated sequ…
Rotate Image
Rotate an n x n matrix 90 degrees clockwise in-place using array manipulation and mathematical indexing techniques effic…
Group Anagrams
Group the anagrams in a list of strings using efficient hash table-based methods, focusing on array scanning.
Pow(x, n)
Calculate x to the power n efficiently using recursion and exponentiation, handling negative powers and large inputs saf…
Maximum Subarray
Maximum Subarray is a classic state transition dynamic programming problem about deciding whether to extend or restart a…
Spiral Matrix
Given an m x n matrix, return all elements in spiral order starting from the top-left corner.
Jump Game
Solve the Jump Game problem using state transition dynamic programming to determine if you can reach the last index of t…
Merge Intervals
Merge Intervals requires sorting an array of interval pairs and combining overlaps efficiently using sequential comparis…
Insert Interval
Given a sorted array of non-overlapping intervals, insert a new interval and merge any overlapping intervals.
Spiral Matrix II
Generate a spiral matrix of size n x n, filled with elements from 1 to n² in spiral order, for interview-focused solving…
Rotate List
Rotate a singly linked list to the right by k positions using careful pointer manipulation and two-pointer traversal tec…
Unique Paths
Calculate the number of unique paths for a robot to move on an m x n grid with only right and down movements.
Unique Paths II
Calculate the number of unique paths from top-left to bottom-right in a grid with obstacles using dynamic programming st…
Minimum Path Sum
Compute the minimum sum from top-left to bottom-right in a grid using state transition dynamic programming efficiently.
Simplify Path
Simplify a Unix-style path by transforming it into its canonical form using stack-based state management.
Edit Distance
Determine the minimum number of insertions, deletions, or replacements to transform one string into another using dynami…
Set Matrix Zeroes
Modify the matrix in place by setting rows and columns to zero when an element is zero.
Search a 2D Matrix
Search a 2D matrix efficiently using binary search over its linearized index, ensuring correctness in row-major sorted a…
Sort Colors
Sort Colors requires in-place reordering of an array using a two-pointer scanning strategy to group 0s, 1s, and 2s effic…
Combinations
Generate all combinations of k numbers from the range [1, n] using backtracking and pruning.
Subsets
Generate all subsets of a set of unique integers using backtracking with pruning to avoid duplicates.
Word Search
Solve Word Search with backtracking by exploring adjacent cells to match a target word in a grid.
Remove Duplicates from Sorted Array II
Solve the problem of removing duplicates from a sorted array in-place, ensuring each element appears at most twice, usin…
Search in Rotated Sorted Array II
Determine if a target exists in a rotated sorted array that may contain duplicates using a binary search variation effic…
Remove Duplicates from Sorted List II
Remove duplicates from a sorted linked list, leaving only distinct values, and return the modified list in sorted order.
Partition List
Partition a linked list such that all nodes less than x come before nodes greater than or equal to x while preserving re…
Gray Code
Generate an n-bit Gray Code sequence using backtracking with pruning and bit manipulation techniques.
Subsets II
Subsets II problem asks to generate unique subsets from an array with possible duplicates using backtracking search with…
Decode Ways
Decode Ways is a dynamic programming problem focused on decoding a numeric string to letters using specific mappings.
Reverse Linked List II
Reverse a segment of a singly linked list from position left to right using precise pointer manipulation techniques.
Restore IP Addresses
Restore all valid IP addresses from a string using backtracking with pruning, avoiding invalid segments or leading zeros…
Unique Binary Search Trees II
Generate all structurally unique BSTs with values 1 to n using backtracking and recursive tree construction techniques.
Unique Binary Search Trees
Given n nodes, calculate the number of unique binary search trees (BSTs) that can be formed with values from 1 to n.
Interleaving String
The Interleaving String problem requires determining if a string can be formed by interleaving two others, utilizing dyn…
Validate Binary Search Tree
Validate Binary Search Tree problem checks if a binary tree satisfies BST properties using tree traversal and state trac…
Recover Binary Search Tree
Recover a BST where two nodes are swapped by mistake using in-order traversal and careful state tracking to restore corr…
Binary Tree Level Order Traversal
Perform a level order traversal on a binary tree using BFS to return node values level by level.
Binary Tree Zigzag Level Order Traversal
Traverse a binary tree in zigzag level order, alternating directions at each depth using BFS and state tracking techniqu…
Construct Binary Tree from Preorder and Inorder Traversal
Construct a binary tree using preorder and inorder traversal arrays, leveraging array scanning and hash table lookups.
Construct Binary Tree from Inorder and Postorder Traversal
Reconstruct a binary tree from given inorder and postorder arrays using array scanning and hash lookup to optimize recur…
Binary Tree Level Order Traversal II
Return a bottom-up level order traversal of a binary tree, processing nodes left to right while tracking each level accu…
Convert Sorted List to Binary Search Tree
Convert a sorted singly linked list into a height-balanced BST using pointer manipulation and divide-and-conquer recursi…
Path Sum II
Find all root-to-leaf paths in a binary tree where the sum of node values equals a given target using DFS backtracking.
Flatten Binary Tree to Linked List
Flatten a binary tree into a right-skewed linked list by manipulating pointers following a pre-order traversal, handling…
Populating Next Right Pointers in Each Node
Connect each node across every level by reusing established next links to traverse a perfect binary tree without extra q…
Populating Next Right Pointers in Each Node II
Populate each next pointer in a binary tree to its immediate right node, handling nulls and uneven levels efficiently us…
Triangle
Given a triangle, return the minimum path sum from top to bottom, moving to adjacent numbers in the row below.
Best Time to Buy and Sell Stock II
Maximize stock profit by using a greedy approach to buy and sell multiple times, with state transition dynamic programmi…
Longest Consecutive Sequence
Find the length of the longest consecutive elements sequence in an unsorted array using array scanning and hash lookup.
Sum Root to Leaf Numbers
Calculate the sum of all root-to-leaf numbers in a binary tree where each path represents a number.
Surrounded Regions
Transform the matrix in-place by marking regions surrounded by 'X' as 'X', while keeping border-adjacent 'O's intact.
Palindrome Partitioning
Find all possible palindrome partitioning of a string using backtracking and dynamic programming.
Clone Graph
Clone Graph involves cloning a graph using DFS, focusing on graph traversal and neighbor management using hash tables.
Gas Station
The Gas Station problem requires finding the starting station index for a full circular trip with gas stations and costs…
Single Number II
Find the single element in an array where every other element appears three times, using bit manipulation and constant s…
Copy List with Random Pointer
This problem requires copying a linked list where each node has a random pointer in addition to the next pointer.
Word Break
Determine if a string can be fully segmented into dictionary words using array scanning and hash-based lookups for effic…
Linked List Cycle II
Identify the start of a cycle in a linked list using pointer manipulation, efficiently handling edge cases without modif…
Reorder List
Reorder List requires careful pointer manipulation in a singly linked list to interleave nodes from the ends without alt…
LRU Cache
Implement an efficient LRU Cache using hash table and doubly-linked list to achieve O(1) operations for get and put.
Insertion Sort List
Sort a singly linked list using insertion sort by carefully manipulating pointers to maintain a sorted order efficiently…
Sort List
Sort List requires sorting a singly linked list efficiently using pointer manipulation and merge sort for optimal perfor…
Evaluate Reverse Polish Notation
Compute the result of an arithmetic expression in Reverse Polish Notation using a stack to manage operands efficiently.
Reverse Words in a String
Reverse Words in a String requires reordering words using precise two-pointer scanning with careful space handling for e…
Maximum Product Subarray
Find the subarray with the largest product in an integer array using dynamic programming techniques.
Find Minimum in Rotated Sorted Array
Find the minimum element in a rotated sorted array using binary search to efficiently identify the point of rotation.
Min Stack
Design a stack with O(1) operations to push, pop, retrieve the top element, and get the minimum element in constant time…
Find Peak Element
Find Peak Element leverages binary search for efficiently locating a peak in an array, a problem commonly asked in techn…
Maximum Gap
Find the largest difference between successive elements in a sorted array efficiently using linear time techniques and b…
Compare Version Numbers
Compare two version numbers by checking their individual revisions, considering missing revisions as zero, using a two-p…
Fraction to Recurring Decimal
Convert a fraction into a decimal, handling repeating decimals with parentheses around the repeating part.
Two Sum II - Input Array Is Sorted
Solve the Two Sum II problem efficiently using binary search over a valid answer space in a sorted array.
Factorial Trailing Zeroes
Given a number n, find how many trailing zeroes are in n! using a math-driven approach.
Binary Search Tree Iterator
Implement an iterator for in-order traversal of a binary search tree (BST), maintaining traversal state with stack-based…
Largest Number
The problem asks to arrange integers to form the largest possible number, focusing on greedy algorithms and string handl…
Repeated DNA Sequences
Solve Repeated DNA Sequences by sliding a length-10 window and tracking seen patterns with a hash set or bitmask.
Rotate Array
Rotate Array challenges you to shift elements right by k steps using precise two-pointer scanning and invariant tracking…
House Robber
Maximize the amount of money you can rob tonight without alerting the police by applying dynamic programming with state …
Binary Tree Right Side View
The Binary Tree Right Side View problem asks you to return the visible nodes from the right side of a binary tree, trave…
Number of Islands
Count the number of distinct islands in a binary grid using array traversal combined with depth-first search exploration…
Bitwise AND of Numbers Range
Use shared high bits and bit clearing to solve Bitwise AND of Numbers Range without scanning every value.
Count Primes
Count all prime numbers less than a given integer n using efficient array and math-based enumeration techniques.
Course Schedule
Determine if all courses can be completed by analyzing prerequisite dependencies using indegree tracking and topological…
Implement Trie (Prefix Tree)
This problem requires designing a Trie (Prefix Tree) to efficiently store and query strings using hash table concepts fo…
Minimum Size Subarray Sum
Find the minimal length of a subarray whose sum is greater than or equal to the target using efficient algorithms.
Course Schedule II
Solve the 'Course Schedule II' problem using graph indegree and topological ordering, utilizing DFS or BFS to find the c…
Design Add and Search Words Data Structure
Build a WordDictionary supporting dynamic word addition and search with wildcard matching efficiently using Trie and DFS…
House Robber II
Maximize your loot by robbing houses arranged in a circle without alerting the police using dynamic programming.
Kth Largest Element in an Array
Find the kth largest element in an unsorted array using optimal approaches like Quickselect or heaps.
Combination Sum III
Find all unique combinations of k numbers adding to n using efficient backtracking with pruning in arrays.
Maximal Square
Maximal Square is a matrix-based dynamic programming problem that focuses on finding the largest square filled with 1's.
Rectangle Area
Calculate the total area covered by two rectangles using geometry, handling overlaps and avoiding double counting effici…
Basic Calculator II
Basic Calculator II evaluates a mathematical expression with operators and integers, handling basic arithmetic with prec…
Majority Element II
Identify all elements in an integer array appearing more than ⌊ n/3 ⌋ times using efficient array scanning and hash coun…
Kth Smallest Element in a BST
Find the kth smallest element in a BST by leveraging in-order traversal to efficiently track node order and count.
Lowest Common Ancestor of a Binary Search Tree
Find the lowest common ancestor (LCA) of two nodes in a binary search tree, using binary-tree traversal and state tracki…
Lowest Common Ancestor of a Binary Tree
Identify the lowest common ancestor of two nodes in a binary tree using traversal and state tracking techniques efficien…
Delete Node in a Linked List
Delete Node in a Linked List focuses on pointer manipulation to delete a node in a singly linked list without access to …
Product of Array Except Self
Solve the 'Product of Array Except Self' problem by calculating the product of all elements except self for each index e…
Search a 2D Matrix II
Efficiently search for a target in a 2D matrix using binary search and matrix properties.
Different Ways to Add Parentheses
Solve Different Ways to Add Parentheses by splitting on each operator and memoizing every subexpression result list.
Single Number III
Find the two unique numbers in an array where all other numbers appear exactly twice using bit manipulation efficiently.
Ugly Number II
Find the nth ugly number, where ugly numbers have prime factors limited to 2, 3, and 5.
H-Index
Determine a researcher's h-index by analyzing citations using array sorting and counting techniques efficiently and accu…
H-Index II
Compute a researcher's H-Index from a sorted citation array using binary search over the valid answer space efficiently.
Perfect Squares
Perfect Squares asks for the least number of perfect squares summing to a given integer n using dynamic programming or B…
Peeking Iterator
Design an iterator with peek functionality, adding to the standard next and hasNext operations for efficient element acc…
Find the Duplicate Number
The problem involves finding the duplicate number in an array of integers, using a binary search approach over the valid…
Game of Life
Solve the Game of Life by updating each cell based on its eight neighbors using Array and Matrix simulation patterns eff…
Bulls and Cows
Solve the Bulls and Cows problem using hash tables and string manipulation to track exact and misplaced digits.
Longest Increasing Subsequence
Solve the Longest Increasing Subsequence problem using dynamic programming and binary search to efficiently find the sub…
Range Sum Query 2D - Immutable
Design a 2D matrix class that efficiently handles sum queries with O(1) time complexity using a prefix sum approach.
Additive Number
Additive Number is solved by trying the first two splits, then pruning aggressively while verifying each required sum in…
Range Sum Query - Mutable
Implement a mutable range sum query using efficient design patterns to handle multiple updates and range sum queries.
Best Time to Buy and Sell Stock with Cooldown
Maximize stock profit with cooldown restrictions using state transition dynamic programming to track buy, sell, and cool…
Minimum Height Trees
Identify all roots of a tree that produce minimum height using graph indegree analysis and topological trimming.
Super Ugly Number
Compute the nth super ugly number efficiently using dynamic programming with state transitions based on the given prime …
Remove Duplicate Letters
Remove duplicate letters from a string to produce the lexicographically smallest result using stack-based state manageme…
Maximum Product of Word Lengths
The problem requires finding the maximum product of lengths of two words from an array, where the words don't share comm…
Bulb Switcher
Bulb Switcher challenges you to find how many bulbs remain on after n toggling rounds using a math-based insight.
Coin Change
Find the minimum number of coins needed to reach a target amount using dynamic programming state transitions efficiently…
Wiggle Sort II
Rearrange an array in a way that every odd-indexed element is greater than its adjacent even-indexed elements.
Odd Even Linked List
Reorder a singly linked list by grouping odd-indexed nodes first, followed by even-indexed nodes while preserving relati…
Verify Preorder Serialization of a Binary Tree
Determine if a given string correctly represents a binary tree preorder traversal using state tracking and slot counting…
Increasing Triplet Subsequence
Identify if an array contains a strictly increasing triplet by maintaining a running minimal and middle value efficientl…
House Robber III
Maximize the loot by robbing non-adjacent houses in a binary tree structure using dynamic programming and DFS.
Flatten Nested List Iterator
Implement an iterator to flatten a nested list of integers, accounting for potential nesting levels.
Integer Break
Break an integer into the sum of positive integers to maximize the product using dynamic programming.
Top K Frequent Elements
Find the k most frequent elements from an array using efficient algorithms like hashing and sorting.
Design Twitter
Design Twitter requires implementing post, follow, unfollow, and news feed retrieval using linked-list pointer manipulat…
Count Numbers with Unique Digits
The problem asks to count numbers with unique digits from 0 to 10^n using dynamic programming, math, and backtracking te…
Water and Jug Problem
Determine if two jugs with given capacities can measure an exact target amount using math and DFS strategies efficiently…
Largest Divisible Subset
Find the largest subset of distinct positive integers where every pair satisfies divisibility using state transition dyn…
Sum of Two Integers
Solve the Sum of Two Integers problem using bit manipulation and math to avoid using the operators + and -.
Super Pow
Compute large exponentiations efficiently using modular arithmetic and divide-and-conquer techniques for this Super Pow …
Find K Pairs with Smallest Sums
Find K Pairs with Smallest Sums combines arrays and heap usage to select the smallest sum pairs efficiently.
Guess Number Higher or Lower II
Minimize the maximum cost of guessing a number in a dynamic guessing game using optimal strategies.
Wiggle Subsequence
Find the longest wiggle subsequence in an integer array using state transition dynamic programming with greedy optimizat…
Combination Sum IV
Combination Sum IV asks to find the number of combinations that sum to a given target using elements from an array.
Kth Smallest Element in a Sorted Matrix
Find the kth smallest element in a sorted n x n matrix using efficient binary search or heap strategies for optimized me…
Insert Delete GetRandom O(1)
Implement a data structure supporting insert, delete, and getRandom in average O(1) using array plus hash mapping.
Linked List Random Node
Select a random node from a singly linked list ensuring uniform probability using efficient pointer techniques and reser…
Shuffle an Array
Shuffle an Array requires designing a class to randomly permute an integer array while ensuring all permutations are equ…
Mini Parser
Deserialize a nested list string using stack-based state management, handling integers and nested lists with depth-first…
Lexicographical Numbers
Generate all numbers from 1 to n in lexicographical order using a depth-first search pattern optimized with trie logic f…
Longest Absolute File Path
Find the length of the longest absolute file path in a filesystem string using stack-based depth tracking efficiently.
Elimination Game
Elimination Game uses a systematic removal of numbers with alternating left-right passes, solvable with math and recursi…
UTF-8 Validation
Determine if an integer array represents valid UTF-8 encoding based on its byte sequences using bit manipulation.
Decode String
Decode a nested encoded string using stack-based state management, handling repeated patterns efficiently with recursion…
Longest Substring with At Least K Repeating Characters
Find the length of the longest substring where every character appears at least k times using sliding window and divide-…
Rotate Function
Maximize the rotation function by rotating the array and calculating the weighted sum for all rotations.
Integer Replacement
Find the minimum number of operations to reduce a number to 1 by applying specific operations, using state transition dy…
Random Pick Index
Random Pick Index involves selecting a random index of a target number in an array with possible duplicates.
Evaluate Division
Compute the results of division queries from given equations using graph traversal and depth-first search efficiently.
Nth Digit
Given n, efficiently find the nth digit in the infinite integer sequence using a binary search over valid positions.
Remove K Digits
Remove K Digits requires selecting which digits to drop using a monotonic stack for the smallest possible integer result…
Queue Reconstruction by Height
Reconstruct a queue based on the given heights and the number of taller people in front, using sorting and binary indexe…
Arithmetic Slices
Count the number of arithmetic subarrays in a given integer array using dynamic programming.
Partition Equal Subset Sum
Determine if an array can be partitioned into two subsets with equal sum using dynamic programming techniques.
Pacific Atlantic Water Flow
Find all cells on an island where water can flow to both the Pacific and Atlantic oceans using DFS or BFS.
Battleships in a Board
Count the number of non-overlapping battleships on a 2D board using array traversal and depth-first search patterns effi…
Maximum XOR of Two Numbers in an Array
Find the maximum XOR of two numbers in an integer array using efficient bit manipulation techniques.
Reconstruct Original Digits from English
This problem asks you to reconstruct digits from an out-of-order English string using hash counting and mathematical ded…
Longest Repeating Character Replacement
Find the length of the longest substring after at most k replacements using a sliding window and character count trackin…
Construct Quad Tree
Construct a Quad-Tree from a binary matrix by recursively subdividing regions and tracking uniform states efficiently.
N-ary Tree Level Order Traversal
Perform a level order traversal on an n-ary tree, capturing nodes by depth using breadth-first search with careful state…
Flatten a Multilevel Doubly Linked List
Flatten a multilevel doubly linked list by correctly updating next, prev, and child pointers to create a single-level se…
Minimum Genetic Mutation
Determine the minimum number of single-character gene mutations to reach the target gene using BFS and a hash table look…
Non-overlapping Intervals
Determine the minimum number of intervals to remove from a list to ensure no intervals overlap using dynamic programming…
Path Sum III
Path Sum III challenges you to count paths in a binary tree that sum to a given target value with downward traversal.
Find All Anagrams in a String
Find all starting indices of p's anagrams in s using sliding window and hash table approach.
Find All Duplicates in an Array
Find all integers that appear twice in an array with O(n) time and constant space complexity.
String Compression
Compress a character array in-place by converting consecutive repeated characters into counts using two-pointer scanning…
Add Two Numbers II
Add Two Numbers II involves summing two numbers represented as linked lists and returning the result as a new linked lis…
Number of Boomerangs
Compute all valid boomerang tuples in a point set using array scanning with hash maps to track distances efficiently.
Serialize and Deserialize BST
Design an algorithm to serialize and deserialize a binary search tree with efficient traversal and state tracking.
Delete Node in a BST
Delete Node in a BST hinges on removing one target while preserving in-order ordering through carefully chosen subtree r…
Sort Characters By Frequency
Sort Characters By Frequency requires counting characters efficiently and rearranging a string in descending frequency o…
Minimum Number of Arrows to Burst Balloons
Find the minimum number of arrows needed to burst all balloons by considering greedy choice and invariant validation.
Minimum Moves to Equal Array Elements
Compute the fewest steps to make all elements equal by incrementing n-1 array items, applying array and math reasoning.
4Sum II
Count all quadruples from four integer arrays that sum to zero using efficient array scanning and hash table lookups.
132 Pattern
Identify whether a given integer array contains a 132 pattern subsequence using efficient stack and search techniques.
Circular Array Loop
Detect whether a circular array contains a loop of consistent direction using efficient array scanning and hash lookup t…
Minimum Moves to Equal Array Elements II
Find the minimum moves to equalize all array elements using increments or decrements with array and math techniques.
Can I Win
Determine if the first player can guarantee a win in a turn-based number selection game using state transition dynamic p…
Unique Substrings in Wraparound String
Solve the 'Unique Substrings in Wraparound String' problem using dynamic programming with a state transition approach.
Validate IP Address
Determine whether a given string is a valid IPv4 or IPv6 address using a precise string-driven validation strategy.
Implement Rand10() Using Rand7()
Generate uniform random numbers from 1 to 10 using only rand7(), applying rejection sampling for consistent probability …
Matchsticks to Square
The problem asks to determine if we can use matchsticks to form a square, exploring dynamic programming and backtracking…
Ones and Zeroes
Solve the Ones and Zeroes problem using dynamic programming with state transition, focusing on array and string manipula…
Heaters
Determine the minimum heater radius to cover all houses using a binary search over potential radius values efficiently.
Total Hamming Distance
Calculate the total Hamming distance between all pairs in an integer array using efficient bit manipulation techniques.
Generate Random Point in a Circle
Generate Random Point in a Circle requires creating a uniform random point inside a circle using math and geometry princ…
Magical String
Count the number of '1's in the first n characters of a magical string using two-pointer scanning and invariant tracking…
Predict the Winner
Predict the Winner involves two players taking turns to maximize their score by picking from either end of an array, opt…
Non-decreasing Subsequences
Return all possible non-decreasing subsequences with at least two elements from the input array, nums.
Target Sum
Target Sum requires counting all expressions from nums using '+' or '-' that evaluate exactly to the given target intege…
Random Point in Non-overlapping Rectangles
Design an algorithm to pick random points within non-overlapping rectangles using binary search and reservoir sampling.
Diagonal Traverse
Traverse a matrix diagonally and return all elements in the specific zig-zag order required by the problem pattern.
Next Greater Element II
Solve the Next Greater Element II problem by using a stack-based state management approach for circular arrays.
Most Frequent Subtree Sum
Identify the most frequent subtree sum in a binary tree using DFS and hash table tracking for efficient state management…
Find Bottom Left Tree Value
Find the leftmost value in the last row of a binary tree using efficient traversal strategies.
Find Largest Value in Each Tree Row
Find the largest value in each row of a binary tree using depth-first or breadth-first search techniques.
Longest Palindromic Subsequence
Find the length of the longest palindromic subsequence in a string using precise state transition dynamic programming.
Coin Change II
Calculate the number of unique coin combinations to reach a target amount using state transition dynamic programming eff…
Random Flip Matrix
Design an optimized algorithm to randomly flip an index in a matrix, using hash tables and math for efficient random sel…
Longest Uncommon Subsequence II
Find the longest string in an array that is not a subsequence of any other string, using array scanning and hash checks …
Continuous Subarray Sum
Identify if any continuous subarray sums to a multiple of k using prefix sums and hash table tracking efficiently.
Longest Word in Dictionary through Deleting
Find the longest word in the dictionary that can be formed by deleting characters from a string, using two-pointer scann…
Contiguous Array
Find the maximum length contiguous subarray with equal numbers of 0s and 1s using array scanning and hash lookup efficie…
Beautiful Arrangement
The Beautiful Arrangement problem asks for the number of valid permutations of n integers satisfying specific divisibili…
Random Pick with Weight
Random Pick with Weight requires implementing a probabilistic index picker using prefix sums and binary search efficient…
Minesweeper
Solve the Minesweeper game by updating revealed squares and handling clicks with Depth-First Search and Array manipulati…
K-diff Pairs in an Array
Solve K-diff Pairs in an Array by counting unique differences with a hash map or sorted two-pointer sweep.
Encode and Decode TinyURL
Design a class that encodes and decodes URLs using a URL shortening approach based on hash tables and strings.
Complex Number Multiplication
This problem requires multiplying two complex numbers, given in string form, and returning the result in the same format…
Convert BST to Greater Tree
Convert a BST into a Greater Tree by updating each node’s value with the sum of all greater values in the tree.
Minimum Time Difference
Calculate the smallest time difference between clock points using array manipulation and mathematical conversions effici…
Single Element in a Sorted Array
Find the single non-duplicate element in a sorted array where every other element appears exactly twice.
01 Matrix
The '01 Matrix' problem challenges you to find the nearest zero for each cell in a binary matrix using dynamic programmi…
Number of Provinces
Solve Number of Provinces by scanning the adjacency matrix and launching DFS once per unvisited city component.
Optimal Division
Maximize the value of an expression by optimally placing parentheses for division operations.
Brick Wall
Solve the Brick Wall problem using array scanning and hash lookups to minimize crossed bricks from a vertical line.
Next Greater Element III
Find the next greater integer using the same digits as a given number with precise two-pointer scanning and invariant tr…
Logical OR of Two Binary Grids Represented as Quad-Trees
Compute the logical OR of two binary matrices represented as Quad-Trees using recursive tree traversal and state propaga…
Subarray Sum Equals K
Count the total number of contiguous subarrays in an integer array that sum exactly to a target value k using optimized …
Array Nesting
Find the longest nested set in a permutation array using a depth-first traversal, handling cycles efficiently for medium…
Permutation in String
Check if a string contains a permutation of another string using two-pointer scanning and hash table techniques.
Out of Boundary Paths
Calculate the number of ways a ball can exit a grid using dynamic programming with state transitions for every move comb…
Shortest Unsorted Continuous Subarray
Find the shortest unsorted continuous subarray that, if sorted, would sort the entire array.
Delete Operation for Two Strings
Find the minimum number of steps to make two strings equal by deleting characters, using dynamic programming.
Fraction Addition and Subtraction
Solve fraction addition and subtraction by handling expressions, calculating results, and simplifying fractions to irred…
Valid Square
Determine if four given 2D points form a valid square using geometric distance checks and vector validation techniques.
Construct String from Binary Tree
Given a binary tree, construct a string representation based on preorder traversal while adhering to specific formatting…
Find Duplicate File in System
Find and return duplicate files in the file system, grouping them by their paths and contents using an array scanning ap…
Valid Triangle Number
Count all triplets in an integer array that satisfy the triangle inequality to form valid triangles efficiently using so…
Task Scheduler
Task Scheduler is solved by counting task frequencies and computing how cooldown gaps force idle slots around the most f…
Design Circular Queue
Design a circular queue that allows efficient FIFO operations using linked-list pointer manipulation to optimize space u…
Add One Row to Tree
The problem requires adding a row of nodes to a binary tree at a specified depth.
Maximum Distance in Arrays
Maximum Distance in Arrays uses a greedy running minimum and maximum from previous arrays to validate cross array distan…
Sum of Square Numbers
Given a non-negative integer c, determine if there are two integers whose squares sum to c.
Exclusive Time of Functions
Solve the 'Exclusive Time of Functions' problem using stack-based state management for accurate function execution time …
Shopping Offers
Minimize the cost of purchasing items using available special offers with state transition dynamic programming.
Solve the Equation
Solve the equation for the variable 'x' and determine its value or state if there is no solution or infinite solutions.
Design Circular Deque
Design and implement a circular deque using linked-list pointer manipulation, ensuring efficient insertion and deletion …
Maximum Length of Pair Chain
Determine the maximum length of a chain formed by pairs using dynamic programming and greedy sorting techniques efficien…
Palindromic Substrings
Count all palindromic substrings in a given string using state transition dynamic programming for efficient evaluation.
Replace Words
Replace words in a sentence using the shortest root from a dictionary, applying efficient array scanning and hash lookup…
Dota2 Senate
The Dota2 Senate problem involves simulating voting rounds between Radiant and Dire senators until one party wins, using…
2 Keys Keyboard
Minimize the number of operations to get exactly 'n' characters on the screen using two operations: Copy All and Paste.
Find Duplicate Subtrees
Identify all duplicate subtrees in a binary tree by efficiently tracking structure and values with depth-first traversal…
Maximum Binary Tree
Construct a maximum binary tree by recursively selecting the largest element and dividing the array into left and right …
Print Binary Tree
Print Binary Tree requires arranging a binary tree into a visually structured matrix using precise traversal and positio…
Find K Closest Elements
Identify the k integers closest to a target x in a sorted array using binary search and two-pointer strategies efficient…
Split Array into Consecutive Subsequences
Verify if it's possible to split a sorted array into consecutive subsequences of length 3 or more.
Maximum Width of Binary Tree
Determine the maximum width of a binary tree by calculating the width of each level and considering the positions of the…
Non-decreasing Array
Check if an array can become non-decreasing by modifying at most one element using an array-driven solution strategy.
Beautiful Arrangement II
Construct a beautiful arrangement of integers from 1 to n with k distinct integers, optimizing for time and space effici…
Trim a Binary Search Tree
Trim a Binary Search Tree by maintaining its structure while removing nodes outside a given range.
Maximum Swap
Given an integer, swap at most two digits once to produce the largest possible number using greedy digit selection.
Bulb Switcher II
Compute all unique bulb configurations after a fixed number of presses using math and bit manipulation efficiently.
Number of Longest Increasing Subsequence
This problem challenges you to find the number of longest increasing subsequences in a given array of integers.
Implement Magic Dictionary
Design a Magic Dictionary to allow searching with one-character modifications, using Hash Table and String techniques.
Map Sum Pairs
Design and implement a data structure that supports efficient insertion and sum queries based on string prefixes.
Valid Parenthesis String
Solve the Valid Parenthesis String problem by leveraging state transition dynamic programming to handle parentheses and …
Redundant Connection
Identify and remove the redundant edge that causes a cycle in a graph starting as a tree.
Repeated String Match
Find the minimum number of repetitions of string a to make string b a substring of the repeated string a.
Longest Univalue Path
Find the longest path in a binary tree where all nodes share the same value using depth-first search efficiently.
Knight Probability in Chessboard
Calculate the probability that a knight remains on an n x n chessboard after making exactly k moves using dynamic progra…
Employee Importance
Calculate an employee's total importance including all direct and indirect subordinates using array scanning and hash lo…
Top K Frequent Words
Solve Top K Frequent Words by counting each word, then ordering ties alphabetically so frequency wins before lexicograph…
Max Area of Island
Find the largest connected land area in a binary grid using array traversal and depth-first search efficiently.
Partition to K Equal Sum Subsets
Determine if an integer array can be partitioned into k subsets where each subset sums to the same value using DP and ba…
Insert into a Binary Search Tree
Insert a value into a Binary Search Tree while maintaining the BST properties, focusing on tree traversal and state trac…
Design Linked List
Implement a custom linked list supporting head, tail, index insertions, retrieval, and deletions efficiently with pointe…
Minimum ASCII Delete Sum for Two Strings
This problem focuses on minimizing the ASCII delete sum for two strings by using dynamic programming to find the lowest …
Subarray Product Less Than K
Count subarrays with a product strictly less than a given value k using efficient algorithms like binary search and slid…
Best Time to Buy and Sell Stock with Transaction Fee
Maximize stock trading profits accounting for per-transaction fees using state transition dynamic programming and greedy…
Maximum Length of Repeated Subarray
Find the maximum length of a subarray that appears in both given integer arrays using dynamic programming.
Longest Word in Dictionary
Find the longest word in a dictionary that can be built one character at a time from other words in the dictionary.
Accounts Merge
Merge accounts by connecting emails and returning each user's sorted email list using array scanning and hash lookup eff…
Remove Comments
Remove comments from a given C++ program source array, handling line and block comments.
Split Linked List in Parts
Efficiently split a singly linked list into k consecutive parts, balancing sizes while preserving the original node orde…
My Calendar I
Implement a calendar supporting non-overlapping event bookings using binary search for efficient insertion and conflict …
My Calendar II
Implement a calendar that allows double bookings but prevents triple bookings, managing overlapping intervals efficientl…
Asteroid Collision
Determine the final positions of moving asteroids using a stack-based simulation for efficient collision resolution in l…
Monotone Increasing Digits
Determine the largest number less than or equal to n with digits in non-decreasing order using a greedy, invariant-drive…
Daily Temperatures
In the Daily Temperatures problem, you need to find out how many days to wait for a warmer temperature based on given da…
Delete and Earn
Maximize points by deleting numbers from an array while removing all adjacent values, using dynamic programming efficien…
Network Delay Time
Find the minimum time for a signal to travel to all nodes in a directed graph or determine if it's impossible.
Open the Lock
Solve the Open the Lock problem using array scanning plus hash lookup to efficiently find the shortest unlock sequence.
Reach a Number
Determine the minimum number of moves to reach a target on an infinite number line using step increments, leveraging bin…
Pyramid Transition Matrix
The Pyramid Transition Matrix problem requires determining whether a pyramid can be formed with given blocks and valid p…
Partition Labels
Partition a string into maximal parts so that each letter appears in only one segment, using two-pointer scanning.
Largest Plus Sign
Find the largest axis-aligned plus sign in a binary grid with some mines using dynamic programming.
Reorganize String
Reorganize a string so that no two adjacent characters are the same, if possible, using a greedy approach.
Max Chunks To Make Sorted
The Max Chunks To Make Sorted problem requires you to split an array into the maximum number of chunks that can be sorte…
Global and Local Inversions
Determine if every global inversion in a permutation array is also a local inversion using array and math logic efficien…
Swap Adjacent in LR String
Transform one string into another by swapping adjacent 'L' and 'R' characters in a sequence of moves.
K-th Symbol in Grammar
Determine the K-th symbol in a recursively generated grammar table using math and bit manipulation patterns efficiently.
Rabbits in Forest
Solve Rabbits in Forest by grouping equal answers and rounding each group into the smallest valid color-class size.
Letter Case Permutation
Letter Case Permutation involves generating all possible strings by changing the case of each letter in a given string.
Is Graph Bipartite?
Determine whether an undirected graph can be split into two independent sets using DFS, BFS, or Union Find patterns.
K-th Smallest Prime Fraction
Find the k-th smallest fraction from a sorted array of unique primes using a binary search over the answer space.
Cheapest Flights Within K Stops
Find the cheapest flight from a source to a destination with at most K stops using graph traversal techniques efficientl…
Rotated Digits
Count all integers from 1 to n that transform into a different valid number when each digit is rotated 180 degrees using…
Escape The Ghosts
Escape The Ghosts tests your ability to analyze movements in an infinite grid while racing against ghost positions using…
Domino and Tromino Tiling
Calculate the number of ways to tile a 2xN board using dominoes and trominoes with precise state transitions.
Custom Sort String
Sort the string `s` according to a custom order defined by string `order`.
Number of Matching Subsequences
Given a string s and a list of words, count how many words are subsequences of s using efficient array scanning and hash…
Valid Tic-Tac-Toe State
Verify if a given Tic-Tac-Toe board can represent a valid game state during a valid sequence of moves.
Number of Subarrays with Bounded Maximum
Count the number of contiguous subarrays with a bounded maximum value using a two-pointer approach.
All Paths From Source to Target
Find all paths in a directed acyclic graph (DAG) from source to target using depth-first search and backtracking.
Champagne Tower
Compute champagne levels in a pyramid of glasses using state transition dynamic programming for accurate distribution tr…
Find Eventual Safe States
Solve the problem of finding eventual safe states in a directed graph using depth-first search and topological sorting.
Max Increase to Keep City Skyline
Maximize building heights in a city grid without changing the skyline, using greedy selection constrained by row and col…
Soup Servings
Compute the probability that soup A empties before soup B using state transition dynamic programming efficiently.
Expressive Words
Expressive Words challenges you to determine if a word can be transformed into a given string by extending groups of rep…
Subdomain Visit Count
The Subdomain Visit Count problem requires counting the visits to all subdomains of a given domain from a list of count-…
Largest Sum of Averages
Maximize the sum of averages by partitioning an integer array into at most k contiguous subarrays using dynamic programm…
Binary Tree Pruning
Binary Tree Pruning removes subtrees not containing a 1, applying binary-tree traversal with state tracking.
Ambiguous Coordinates
Find all valid 2D coordinate possibilities for an ambiguous input string using backtracking and pruning techniques.
Linked List Components
Count the number of connected components in a linked list subset using array scanning and hash table lookups efficiently…
Short Encoding of Words
Find the minimum length of a reference string encoding an array of words using array scanning and hash lookup efficientl…
Card Flipping Game
The Card Flipping Game problem asks for the smallest integer that can be facing down but not up after flipping cards.
Binary Trees With Factors
Given an array of integers, find how many binary trees can be formed such that non-leaf nodes' values are the product of…
Friends Of Appropriate Ages
The Friends Of Appropriate Ages problem involves counting valid friend requests between people based on their ages with …
Most Profit Assigning Work
Assign workers to jobs maximizing total profit using difficulty, profit, and worker arrays efficiently with binary searc…
Masking Personal Information
This problem requires masking sensitive parts of emails and phone numbers using a precise string-driven strategy efficie…
Find And Replace in String
This problem challenges you to perform multiple string replacements at specific indices using a pattern involving array …
Image Overlap
Image Overlap requires calculating the overlap between two binary matrices by translating one image over the other.
New 21 Game
Calculate the probability Alice reaches at most n points using state transition dynamic programming efficiently.
Push Dominoes
In the "Push Dominoes" problem, you simulate the falling dominoes based on their initial states and determine their fina…
Magic Squares In Grid
Scan every 3x3 window, reject invalid digits fast, then verify row, column, and diagonal sums for Magic Squares In Grid.
Keys and Rooms
Determine if all rooms can be visited given keys distributed across a set of interconnected locked rooms using graph tra…
Split Array into Fibonacci Sequence
This problem challenges you to split a string into a Fibonacci-like sequence using backtracking and pruning.
Longest Mountain in Array
Find the length of the longest subarray forming a mountain pattern using state transitions and two-pointer logic efficie…
Hand of Straights
Check if a hand of cards can be rearranged into groups of consecutive values.
Shifting Letters
Given a string and a shift array, shift the first i+1 letters of the string as specified in the array.
Maximize Distance to Closest Person
Determine the seat placement that maximizes distance to the nearest person using a linear array scan strategy efficientl…
Loud and Rich
Determine the quietest person richer than each individual using graph indegree analysis and topological ordering techniq…
Peak Index in a Mountain Array
Find the peak index in a mountain array using binary search for efficient O(log n) time complexity.
Car Fleet
The Car Fleet problem asks how many car fleets will reach a target given their starting positions and speeds, considerin…
Exam Room
Simulate an exam room where each student chooses a seat maximizing distance to others, using design plus heap structures…
Score of Parentheses
Calculate the score of a balanced parentheses string using stack-based state management for an optimal solution.
Mirror Reflection
Given a square room with mirrors, find which receptor a laser ray will hit first based on two integers, p and q.
Score After Flipping Matrix
Maximize the score of a binary matrix by flipping rows and columns using a greedy approach and validation of invariants.
All Nodes Distance K in Binary Tree
Find all nodes at distance K from a target node in a binary tree using various tree traversal techniques.
Smallest Subtree with all the Deepest Nodes
Find the smallest subtree that contains all the deepest nodes in a binary tree.
Prime Palindrome
The Prime Palindrome problem asks for the smallest prime palindrome greater than or equal to a given integer.
Reordered Power of 2
Determine if a number's digits can be rearranged to form a power of two using counting and hash-based checks.
Advantage Shuffle
Maximize the advantage of nums1 over nums2 using a two-pointer greedy strategy, carefully tracking which elements beat o…
Length of Longest Fibonacci Subsequence
Find the length of the longest Fibonacci-like subsequence from a strictly increasing array of integers.
Walking Robot Simulation
The Walking Robot Simulation problem involves moving a robot in an infinite grid and calculating its furthest distance f…
Koko Eating Bananas
Koko Eating Bananas challenges you to find the minimum eating speed to finish piles of bananas in a given time using bin…
Stone Game
Stone Game is a dynamic programming problem where players alternate taking stones from piles to maximize their score.
Decoded String at Index
Decode the string and find the k-th letter efficiently using stack-based state management in this problem.
Boats to Save People
Find the minimum number of boats required to save all people, using a two-pointer approach for efficient pairing.
Spiral Matrix III
Solve the Spiral Matrix III problem by simulating the movement across a matrix with specific constraints on direction an…
Possible Bipartition
Determine if a group of n people with mutual dislikes can be split into two non-conflicting groups using graph traversal…
Construct Binary Tree from Preorder and Postorder Traversal
Reconstruct a binary tree from preorder and postorder traversals using array scanning and hash lookup.
Find and Replace Pattern
Identify all words matching a given pattern by checking consistent letter mappings using hash tables and array scanning …
Groups of Special-Equivalent Strings
Determine the number of special-equivalent string groups using character swaps at even or odd indices efficiently.
All Possible Full Binary Trees
Generate all possible full binary trees with n nodes, focusing on dynamic programming and binary tree traversal.
Bitwise ORs of Subarrays
Compute the number of unique bitwise OR values from all non-empty subarrays using dynamic state transitions efficiently.
RLE Iterator
Design an efficient iterator for a run-length encoded array, handling large counts and sequential access correctly every…
Online Stock Span
Design an efficient algorithm using stacks to calculate the stock span for daily price quotes.
Fruit Into Baskets
The Fruit Into Baskets problem requires finding the maximum number of fruits you can pick from a row of trees under spec…
Sum of Subarray Minimums
Calculate the sum of minimum values across all subarrays of a given array modulo 10^9 + 7.
Snakes and Ladders
Solve the Snakes and Ladders problem using a BFS strategy to efficiently navigate the board and reach the final square.
Smallest Range II
Determine the minimum possible difference between the largest and smallest numbers after adjusting each by plus or minus…
Online Election
Solve the Online Election problem by implementing a class that tracks votes and queries the leading candidate at any giv…
Sort an Array
Sort an array using an optimal algorithm, focusing on time and space complexity considerations.
Partition Array into Disjoint Intervals
Partition the array into two subarrays such that the left contains the smallest possible elements and the right contains…
Word Subsets
Word Subsets is solved by merging words2 into one max-frequency requirement, then scanning words1 against that fixed let…
Maximum Sum Circular Subarray
Find the maximum sum of a circular subarray using state transition dynamic programming, optimizing for wraparound cases …
Complete Binary Tree Inserter
Implement a data structure to insert nodes into a complete binary tree while preserving its completeness efficiently.
Minimum Add to Make Parentheses Valid
Compute the minimum insertions needed to make a parentheses string valid using efficient stack-based state tracking tech…
3Sum With Multiplicity
Count all unique triplets in an integer array whose sum equals the target, handling multiplicity efficiently using hashi…
Flip String to Monotone Increasing
Minimize the number of flips needed to make a binary string monotone increasing using dynamic programming.
Binary Subarrays With Sum
Count all contiguous subarrays in a binary array whose elements sum exactly to a given goal using prefix sums efficientl…
Minimum Falling Path Sum
Minimum Falling Path Sum is a matrix dynamic programming problem where each cell depends on three reachable cells above …
Beautiful Array
Beautiful Array builds a valid permutation by recursively separating odd and even positions so no middle-average triple …
Shortest Bridge
Find the minimum flips to connect two separate islands in a binary matrix using Array and DFS techniques efficiently.
Knight Dialer
Solve the Knight Dialer problem using state transition dynamic programming to efficiently calculate valid number paths f…
Reorder Data in Log Files
Reorder Data in Log Files requires sorting letter-logs lexicographically while keeping digit-logs in original order for …
Minimum Area Rectangle
Find the minimum area of a rectangle formed by given points on a 2D plane with sides parallel to axes.
Minimum Increment to Make Array Unique
This problem challenges you to find the minimum moves to make all elements in an array unique by incrementing elements.
Validate Stack Sequences
Determine if a sequence of push and pop operations can produce the given popped array using a stack-based state approach…
Most Stones Removed with Same Row or Column
Maximize the number of stones removed from a 2D plane using graph traversal and DFS.
Bag of Tokens
Maximize your score in the Bag of Tokens problem by strategically playing tokens with two-pointer scanning and greedy te…
Largest Time for Given Digits
Given four digits, determine the latest valid 24-hour time possible using each digit exactly once with backtracking.
Reveal Cards In Increasing Order
Determine the initial deck order to reveal cards in strictly increasing order using queue-driven simulation logic.
Flip Equivalent Binary Trees
Determine if two binary trees are flip equivalent by recursively swapping subtrees.
Array of Doubled Pairs
Given an array of even length, check if it can be reordered to satisfy a specific doubling condition.
Delete Columns to Make Sorted II
Solve the "Delete Columns to Make Sorted II" problem by applying greedy choices and invariant validation to string array…
Prison Cells After N Days
Determine the state of 8 prison cells after N days using array scanning and cycle detection for repeated patterns effici…
Check Completeness of a Binary Tree
Determine if a binary tree is complete by verifying its node structure and leftmost placement in the last level.
Regions Cut By Slashes
Determine the number of regions in a grid divided by slashes using array scanning and union-find techniques efficiently.
Maximum Width Ramp
Find the maximum width of a ramp where nums[i] <= nums[j] for i < j using a two-pointer approach.
Minimum Area Rectangle II
Find the minimum area rectangle from given points in the X-Y plane, with sides not necessarily parallel to the axes.
Vowel Spellchecker
Implement a spellchecker that matches queries to a wordlist using exact, case-insensitive, and vowel-error rules efficie…
Numbers With Same Consecutive Differences
Generate all n-digit numbers where consecutive digits differ by k using efficient backtracking and BFS techniques.
Pancake Sorting
Sort an array using pancake flips, leveraging two-pointer scanning and invariant tracking to iteratively position the la…
Powerful Integers
Find all integers that can be expressed as x^i + y^j up to a given bound using a Hash Table plus Math approach.
Flip Binary Tree To Match Preorder Traversal
Determine the minimum set of nodes to flip in a binary tree so its pre-order traversal matches a given voyage sequence.
K Closest Points to Origin
Find the k closest points to the origin in a 2D plane using array operations and Euclidean distance calculations efficie…
Subarray Sums Divisible by K
Count the number of subarrays whose sum is divisible by a given integer k using array scanning and hash lookup.
Longest Turbulent Subarray
Find the length of the longest subarray where element comparisons alternate, using state transition dynamic programming …
Distribute Coins in Binary Tree
Minimize the number of moves needed to distribute coins in a binary tree so that each node has exactly one coin.
Time Based Key-Value Store
Implement a time-based key-value store that retrieves the latest value at a given timestamp using efficient binary searc…
Minimum Cost For Tickets
Solve the Minimum Cost For Tickets problem using state transition dynamic programming for optimal travel ticket purchase…
String Without AAA or BBB
Solve the problem of constructing a string without consecutive 'AAA' or 'BBB' by applying a greedy approach with invaria…
Sum of Even Numbers After Queries
Efficiently update an integer array based on queries and compute the sum of even numbers after each modification using s…
Interval List Intersections
This problem requires finding the intersection of two lists of intervals using a two-pointer technique with invariant tr…
Smallest String Starting From Leaf
Determine the lexicographically smallest string from a leaf to root using binary-tree traversal and careful state tracki…
Satisfiability of Equality Equations
Determine if it's possible to assign values to variables such that all equations are satisfied based on equality and ine…
Broken Calculator
Compute the minimum operations to transform startValue into target using doubling and decrementing, leveraging a greedy …
Rotting Oranges
Given a grid with fresh and rotten oranges, return the minimum time for all oranges to rot or -1 if impossible.
Maximum Binary Tree II
The Maximum Binary Tree II problem requires building a binary tree by inserting a value into a maximum binary tree while…
Check If Word Is Valid After Substitutions
Determine if a string can be built from repeated 'abc' insertions using stack-based state management, verifying sequence…
Max Consecutive Ones III
Find the longest consecutive ones in a binary array by optimally flipping at most k zeros using sliding window technique…
Clumsy Factorial
Compute the clumsy factorial of a number using a fixed rotation of multiply, divide, add, and subtract operations effici…
Minimum Domino Rotations For Equal Row
Minimize domino rotations to make either row identical in the problem of Minimum Domino Rotations For Equal Row.
Construct Binary Search Tree from Preorder Traversal
Construct a binary search tree directly from a preorder traversal array using stack-based state tracking efficiently.
Pairs of Songs With Total Durations Divisible by 60
Calculate the number of song pairs whose total durations sum to a multiple of 60 using array scanning and hash lookups.
Capacity To Ship Packages Within D Days
Find the minimum ship capacity needed to ship all packages within D days, ensuring the cargo is shipped in the given ord…
Best Sightseeing Pair
Compute the maximum sightseeing score efficiently using state transition dynamic programming and single-pass array itera…
Smallest Integer Divisible by K
Find the length of the smallest positive integer divisible by k that consists only of the digit '1'.
Binary String With Substrings Representing 1 To N
Check if binary string contains all integers from 1 to n as substrings, leveraging sliding window and bit manipulation t…
Convert to Base -2
Convert any non-negative integer into its base -2 representation using a math-driven iterative remainder strategy.
Next Greater Node In Linked List
Find the next greater value for each node in a linked list using monotonic stack techniques for efficient traversal.
Number of Enclaves
This problem involves finding the number of land cells that cannot reach the boundary in a grid using DFS and array mani…
Camelcase Matching
Camelcase Matching is a medium difficulty problem where you match queries to a given pattern by inserting lowercase lett…
Video Stitching
Solve the "Video Stitching" problem using state transition dynamic programming to cover a sporting event with minimum cl…
Maximum Difference Between Node and Ancestor
Find the maximum absolute difference between a node and its ancestor in a binary tree.
Longest Arithmetic Subsequence
Find the length of the longest arithmetic subsequence in a given integer array using scanning and hash-based lookup.
Two City Scheduling
Two City Scheduling requires selecting optimal city assignments for 2n people to minimize total travel costs efficiently…
Maximum Sum of Two Non-Overlapping Subarrays
Find the maximum sum of two non-overlapping subarrays by efficiently using state transition dynamic programming.
Moving Stones Until Consecutive
Solve the "Moving Stones Until Consecutive" problem using math and brainteaser patterns by determining the minimum and m…
Coloring A Border
Given a grid and a starting cell, color all border cells of the connected component using DFS while preserving interior …
Uncrossed Lines
The Uncrossed Lines problem involves finding the maximum number of non-intersecting lines that can be drawn between two …
Binary Search Tree to Greater Sum Tree
Convert a Binary Search Tree to a Greater Sum Tree by accumulating all larger node values using reverse in-order travers…
Minimum Score Triangulation of Polygon
Compute the minimum total score to triangulate a convex polygon using state transition dynamic programming on vertex val…
Moving Stones Until Consecutive II
Determine the minimum and maximum moves to make stones consecutive using sliding window and endpoint adjustments efficie…
Robot Bounded In Circle
Determine if a robot following a repeated instruction sequence stays within a bounded circle using math and string simul…
Flower Planting With No Adjacent
In this problem, you are tasked with planting flowers in gardens with specific constraints based on graph traversal prin…
Partition Array for Maximum Sum
Partition an array into subarrays of length at most k, replacing each with its maximum to maximize total sum efficiently…
Longest String Chain
Find the longest word chain by scanning arrays and using hash lookups to efficiently track predecessor-successor sequenc…
Last Stone Weight II
In the 'Last Stone Weight II' problem, you need to find the minimal possible stone weight after a series of smashes usin…
Grumpy Bookstore Owner
Maximize satisfied customers in a bookstore by strategically suppressing the owner's grumpy minutes using a sliding wind…
Previous Permutation With One Swap
Find the lexicographically largest permutation smaller than the given array using exactly one swap, leveraging a greedy …
Distant Barcodes
Rearrange barcodes in an array so that no two adjacent elements are equal, using a greedy approach and hash table for ef…
Lexicographically Smallest Equivalent String
Determine the lexicographically smallest string by modeling character equivalences with union find efficiently.
Flip Columns For Maximum Number of Equal Rows
Maximize the number of equal rows in a binary matrix by flipping any number of columns.
Adding Two Negabinary Numbers
Add two numbers represented in negabinary format and return the result in the same format.
Letter Tile Possibilities
Compute all unique non-empty sequences from given letter tiles using backtracking search with pruning efficiently.
Insufficient Nodes in Root to Leaf Paths
Remove nodes in a binary tree whose all root-to-leaf paths sum to less than a given limit using DFS traversal and state …
Smallest Subsequence of Distinct Characters
The Smallest Subsequence of Distinct Characters problem asks you to find the lexicographically smallest subsequence of a…
Largest Values From Labels
Maximize the sum of selected item values while respecting label use limits using array scanning and hash tracking.
Shortest Path in Binary Matrix
Find the shortest clear path in a binary matrix using BFS, carefully handling obstacles and diagonal movements for effic…
Statistics from a Large Sample
Calculate minimum, maximum, mean, median, and mode from a large sample represented by an array of counts.
Car Pooling
Determine if a car can handle multiple trips without exceeding its capacity using array sorting and event simulation tec…
Path In Zigzag Labelled Binary Tree
The problem involves finding the path from the root to a node in a zigzag-labelled binary tree.
Filling Bookcase Shelves
Determine the minimum total height of a bookcase by placing books in order using state transition dynamic programming.
Corporate Flight Bookings
Solve Corporate Flight Bookings by marking range changes once, then building final seat totals with a single prefix sum …
Delete Nodes And Return Forest
Delete nodes from a binary tree using array scanning and hash lookup to return the remaining forest efficiently.
Maximum Nesting Depth of Two Valid Parentheses Strings
This problem challenges you to compute the maximum nesting depth of two valid parentheses strings using stack-based stat…
Lowest Common Ancestor of Deepest Leaves
Find the lowest common ancestor of the deepest leaves in a binary tree using efficient traversal and state tracking tech…
Longest Well-Performing Interval
The Longest Well-Performing Interval problem challenges you to find the longest subarray where tiring days exceed non-ti…
Shortest Path with Alternating Colors
Solve the shortest path problem with alternating edge colors using graph traversal and BFS.
Minimum Cost Tree From Leaf Values
Compute the minimum sum of non-leaf nodes in a binary tree formed from array leaves using dynamic programming efficientl…
Maximum of Absolute Value Expression
Calculate the largest sum of absolute differences across two arrays and their indices using an efficient pattern-based a…
Alphabet Board Path
Find the path to type a target string on an alphabet board using directional moves and the 'hash table plus string' patt…
Largest 1-Bordered Square
Find the largest square of 1s with 1s on its borders in a binary grid using dynamic programming.
Stone Game II
Stone Game II is a dynamic programming problem where Alice and Bob alternate taking stones from piles to maximize their …
Longest Common Subsequence
Find the length of the longest common subsequence between two strings using state transition dynamic programming for eff…
Decrease Elements To Make Array Zigzag
Transform any integer array into a zigzag pattern with minimal decrements using a targeted greedy approach and invariant…
Binary Tree Coloring Game
A two-player game where players color nodes in a binary tree, aiming to outmaneuver each other by choosing adjacent node…
Snapshot Array
Implement a SnapshotArray that efficiently tracks element changes and retrieves past states using array scanning and has…
Number of Dice Rolls With Target Sum
Calculate the number of ways to roll n dice with k faces to reach a target sum using state transition dynamic programmin…
Swap For Longest Repeated Character Substring
Find the maximum length of a repeated character substring after swapping two characters using a sliding window approach …
Maximum Level Sum of a Binary Tree
Find the level of a binary tree where the sum of its nodes is maximal, with an emphasis on binary-tree traversal.
As Far from Land as Possible
Find the farthest water cell from land in a grid and return the Manhattan distance using state transition dynamic progra…
Invalid Transactions
Detect invalid transactions by scanning arrays and cross-checking with hash tables for time, amount, and city conflicts …
Compare Strings by Frequency of the Smallest Character
Compare Strings by Frequency of the Smallest Character requires counting minimal character frequencies in words and quer…
Remove Zero Sum Consecutive Nodes from Linked List
Remove zero-sum consecutive nodes from a linked list by iterating through it, repeatedly deleting sequences that sum to …
Can Make Palindrome from Substring
Given a string and queries, determine if a substring can be rearranged and modified to form a palindrome.
Maximum Subarray Sum with One Deletion
Find the maximum sum of a subarray with at most one deletion in this dynamic programming problem.
Reverse Substrings Between Each Pair of Parentheses
Reverse all substrings within matched parentheses using a stack-based approach for efficient state tracking and reversal…
K-Concatenation Maximum Sum
Solve the K-Concatenation Maximum Sum problem using dynamic programming and optimal sub-array sum calculation.
Ugly Number III
Find the nth positive integer divisible by a, b, or c using binary search over the answer space efficiently and accurate…
Smallest String With Swaps
Find the lexicographically smallest string by swapping characters in given pairs of indices.
Get Equal Substrings Within Budget
Optimize substring transformations using a binary search approach to maximize the change within a budget.
Remove All Adjacent Duplicates in String II
Remove all adjacent duplicates in the string using stack-based state management with a given threshold k.
Longest Arithmetic Subsequence of Given Difference
Find the longest arithmetic subsequence with a given difference using dynamic programming and hash tables.
Path with Maximum Gold
Find the path with the maximum gold in a grid with backtracking and pruning techniques to maximize the gold collected.
Queens That Can Attack the King
Identify all black queens on an 8x8 chessboard that can attack the white king using array and matrix simulation techniqu…
Airplane Seat Assignment Probability
Calculate the probability that the last passenger sits in their assigned seat using state transition dynamic programming…
Remove Sub-Folders from the Filesystem
Remove sub-folders in a filesystem by filtering out folders nested inside other folders.
Replace the Substring for Balanced String
Determine the minimum substring length to replace in order to balance a string of Q, W, E, and R characters efficiently.
Find Positive Integer Solution for a Given Equation
Determine all positive integer pairs that satisfy a hidden monotonic function for a given target using binary search ove…
Circular Permutation in Binary Representation
Generate a circular permutation from a range of numbers using backtracking and bit manipulation.
Maximum Length of a Concatenated String with Unique Characters
Find the maximum length of a concatenated string from an array with all unique characters using backtracking search with…
Minimum Swaps to Make Strings Equal
This problem requires determining the minimum number of swaps to make two strings equal by swapping characters between t…
Count Number of Nice Subarrays
The problem requires counting subarrays with exactly k odd numbers using an efficient array scanning approach.
Minimum Remove to Make Valid Parentheses
Given a string with parentheses and letters, remove the fewest parentheses to produce any valid balanced string efficien…
Reconstruct a 2-Row Binary Matrix
Reconstruct a 2-row binary matrix by distributing column sums while respecting upper and lower row limits using greedy p…
Number of Closed Islands
Count the number of closed islands in a 2D grid using array traversal and depth-first search efficiently.
Find Elements in a Contaminated Binary Tree
Recover values in a contaminated binary tree and efficiently check for existence using traversal and state tracking tech…
Greatest Sum Divisible by Three
Find the maximum sum divisible by three from a given array using dynamic programming and state transition.
Count Servers that Communicate
Count Servers that Communicate involves identifying servers in a grid that can communicate based on row or column connec…
Search Suggestions System
Design a search suggestion system that provides the top three lexicographically smallest products matching a search word…
Number of Burgers with No Waste of Ingredients
Determine the exact counts of jumbo and small burgers using all tomato and cheese slices without leftovers, applying mat…
Count Square Submatrices with All Ones
Count the number of square submatrices with all ones in a given binary matrix using dynamic programming.
Group the People Given the Group Size They Belong To
Organize people into groups based on their specified group sizes using array scanning and hash table bucketing efficient…
Find the Smallest Divisor Given a Threshold
Find the smallest divisor such that the sum of all divided array elements is less than or equal to the threshold.
Iterator for Combination
Implement an iterator that generates all combinations of a given length using efficient backtracking with pruning.
Remove Covered Intervals
Remove all intervals fully covered by another using sorting and linear traversal, counting only distinct remaining inter…
Sequential Digits
Find all integers within a range whose digits form a strictly increasing consecutive sequence using enumeration techniqu…
Maximum Side Length of a Square with Sum Less than or Equal to Threshold
This problem challenges you to find the largest square in a matrix with a sum below a given threshold using binary searc…
Divide Array in Sets of K Consecutive Numbers
Determine if an integer array can be partitioned into sets of k consecutive numbers using array scanning and hash mappin…
Maximum Number of Occurrences of a Substring
Find the maximum number of occurrences of any valid substring in a given string with specific constraints on letter coun…
Sum of Mutated Array Closest to Target
Find the integer that mutates all larger elements in an array to minimize the sum difference to a target efficiently.
Deepest Leaves Sum
Find the sum of the deepest leaves in a binary tree by using tree traversal and state tracking techniques.
All Elements in Two Binary Search Trees
Merge elements from two binary search trees and return them sorted in ascending order.
Jump Game III
Jump Game III challenges you to determine if you can reach any zero in an array using jumps defined by array values, tes…
XOR Queries of a Subarray
Compute XOR results for multiple subarray queries using efficient prefix XOR to reduce repeated computation overhead in …
Get Watched Videos by Your Friends
Find videos watched by friends up to a given level and return them sorted by frequency and alphabetically.
Matrix Block Sum
Compute a matrix where each cell contains the sum of all elements within k-distance blocks using prefix sums efficiently…
Sum of Nodes with Even-Valued Grandparent
This problem involves calculating the sum of nodes with an even-valued grandparent in a binary tree.
Minimum Flips to Make a OR b Equal to c
Determine the minimum number of bit flips required in two integers so that their OR equals a target integer efficiently.
Number of Operations to Make Network Connected
Determine the minimum number of operations required to connect all computers in a network with a limited number of cable…
Print Words Vertically
Transform a string into vertical columns by arranging each word character in array positions while trimming trailing spa…
Delete Leaves With a Given Value
In this problem, you need to delete all leaf nodes in a binary tree with a given target value, performing continuous del…
Break a Palindrome
Given a palindrome, change exactly one character to make it non-palindromic and lexicographically smallest using a greed…
Sort the Matrix Diagonally
Sort each diagonal of a matrix in ascending order, applying sorting and matrix traversal techniques.
Filter Restaurants by Vegan-Friendly, Price and Distance
Filter restaurants by vegan-friendly status, price, and distance, and sort them by rating and ID.
Find the City With the Smallest Number of Neighbors at a Threshold Distance
Find the city with the fewest neighbors within a given threshold distance using dynamic programming.
Reduce Array Size to The Half
This problem asks to minimize the set of integers removed to reduce an array's size to at least half by removing occurre…
Maximum Product of Splitted Binary Tree
Maximize the product of sums of two subtrees formed by splitting a binary tree.
Number of Sub-arrays of Size K and Average Greater than or Equal to Threshold
Given an array, find the number of sub-arrays of size k with an average greater than or equal to a given threshold.
Angle Between Hands of a Clock
Calculate the smaller angle between the hour and minute hands of a clock based on given time inputs.
Minimum Number of Steps to Make Two Strings Anagram
Calculate the minimum steps to transform one string into an anagram of another using character replacements efficiently.
Tweet Counts Per Frequency
Design an efficient solution to track and retrieve tweet counts over different frequencies using binary search and hash …
Product of the Last K Numbers
Design a data structure to efficiently return the product of the last k numbers in a dynamic integer stream using prefix…
Maximum Number of Events That Can Be Attended
Maximize the number of events you can attend given their start and end days using a greedy strategy.
Apply Discount Every n Orders
Compute customer bills with periodic discounts efficiently using array scanning and hash mapping for fast product price …
Number of Substrings Containing All Three Characters
Count all substrings containing at least one of each character a, b, and c using a sliding window approach efficiently.
Validate Binary Tree Nodes
Validate Binary Tree Nodes problem requires checking if a set of nodes forms a valid binary tree using graph traversal.
Closest Divisors
Find the closest divisors of num + 1 and num + 2 with minimal absolute difference in this math-driven problem.
Rank Teams by Votes
Rank Teams by Votes requires counting position-based votes and resolving ties with array scanning and hash lookup techni…
Linked List in Binary Tree
Determine if a linked list is represented as a downward path in a binary tree using pointer traversal and recursive chec…
Find the Longest Substring Containing Vowels in Even Counts
Find the longest substring with even counts of vowels using bitmasking and hash tables.
Longest ZigZag Path in a Binary Tree
Find the longest ZigZag path in a binary tree using depth-first search and dynamic programming for precise node state tr…
Number of Times Binary String Is Prefix-Aligned
Count how many times a 1-indexed binary string becomes prefix-aligned as bits are flipped sequentially using an array-dr…
Time Needed to Inform All Employees
Calculate the time needed for the head of a company to inform all employees using tree traversal techniques.
Design a Stack With Increment Operation
Implement a stack that supports push, pop, and targeted increment operations efficiently using array-based state managem…
Balance a Binary Search Tree
This problem requires balancing a binary search tree using in-order traversal and state tracking techniques.
Cinema Seat Allocation
Determine the maximum number of four-person groups that can be seated in a cinema using array scanning and hash lookup e…
Sort Integers by The Power Value
Sort integers in a range based on their power value using dynamic programming and memoization, handling ties with ascend…
Four Divisors
Compute the sum of all divisors for numbers in an array that have exactly four divisors using array and math techniques.
Check if There is a Valid Path in a Grid
Check if there is a valid path from the upper-left to the bottom-right corner of a grid using depth-first search.
Count Number of Teams
Count the number of valid three-soldier teams using ratings with a state transition dynamic programming approach efficie…
Design Underground System
Design an underground system to calculate travel times between stations using hash tables for efficient lookups and aver…
Construct K Palindrome Strings
Determine if a string's characters can be rearranged to form exactly k non-empty palindrome strings using greedy validat…
Circle and Rectangle Overlapping
Determine if a circle intersects with an axis-aligned rectangle using geometric distance checks efficiently in code.
Number of Steps to Reduce a Number in Binary Representation to One
Determine the number of steps to reduce a binary representation of a number to 1 by following specific rules.
Longest Happy String
Solve the "Longest Happy String" problem using a greedy approach with validation of invariants for constructing the long…
Queries on a Permutation With Key
This problem involves processing queries on a permutation using an array and binary indexed tree for efficient results.
HTML Entity Parser
Transform a string containing HTML entities into their character equivalents using a hash table for efficient parsing.
Find the Minimum Number of Fibonacci Numbers Whose Sum Is K
Find the minimum number of Fibonacci numbers that sum up to a given integer k, using a greedy approach.
The k-th Lexicographical String of All Happy Strings of Length n
Given n and k, find the k-th lexicographical happy string of length n using backtracking search with pruning.
Display Table of Food Orders in a Restaurant
Generate a restaurant display table from orders by counting each food item per table using array scanning and hash looku…
Minimum Number of Frogs Croaking
Determine the minimum number of frogs required to sequentially produce all croaks in a mixed frog croak string efficient…
Maximum Points You Can Obtain from Cards
Maximize your score by selecting k cards from the beginning or end of the array using a sliding window approach.
Diagonal Traverse II
Traverse a jagged 2D array diagonally by grouping elements with equal row and column sums efficiently using sorting and …
Max Difference You Can Get From Changing an Integer
Compute the maximum difference from changing digits in an integer using greedy choices and invariant checks efficiently.
Check If a String Can Break Another String
This problem checks whether one string can break another using permutations and a greedy approach for comparison.
Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit
Find the longest subarray with elements whose absolute difference is within a specified limit using a sliding window app…
Build an Array With Stack Operations
Simulate stack operations to match a target array while processing numbers from 1 to n.
Count Triplets That Can Form Two Arrays of Equal XOR
Efficiently count all triplets in an array where two subarrays formed by splitting have equal XOR using array scanning a…
Minimum Time to Collect All Apples in a Tree
Minimize the time spent to collect all apples in a tree, considering traversal and state tracking with binary tree techn…
Simplified Fractions
Generate simplified fractions between 0 and 1 with denominators up to a given integer n.
Count Good Nodes in Binary Tree
Count Good Nodes in Binary Tree identifies nodes exceeding all previous values along their path using DFS traversal tech…
Rearrange Words in a Sentence
Rearrange words in a sentence by their length, maintaining original order for words of equal size for consistent output.
People Whose List of Favorite Companies Is Not a Subset of Another List
Identify people whose favorite companies lists are unique and not subsets of any other person's list using efficient arr…
Maximum Number of Vowels in a Substring of Given Length
Find the maximum number of vowels in a substring of a given length in a string using a sliding window approach.
Pseudo-Palindromic Paths in a Binary Tree
Count all root-to-leaf paths in a binary tree that can be rearranged to form a palindrome using bitwise state tracking.
Check If a String Contains All Binary Codes of Size K
Determine if every possible binary string of length k exists as a substring within a given binary string s efficiently u…
Course Schedule IV
Determine if one course is a prerequisite of another using graph indegree tracking and topological ordering efficiently.
Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
Maximize the area of a piece of cake after specified horizontal and vertical cuts using greedy algorithms and sorting.
Reorder Routes to Make All Paths Lead to the City Zero
Reorder Routes to Make All Paths Lead to the City Zero involves reversing the direction of roads in a tree to ensure all…
The k Strongest Values in an Array
Identify the k strongest values in an array using two-pointer scanning and careful tracking of the array's centre value.
Design Browser History
Implement a browser history tracker with back, forward, and visit operations using linked-list pointer manipulation effi…
Subrectangle Queries
Implement the SubrectangleQueries class to handle dynamic updates and value queries on a 2D rectangle.
Find Two Non-overlapping Sub-arrays Each With Target Sum
Find two non-overlapping sub-arrays with a given target sum and return the minimal total length efficiently using array …
Least Number of Unique Integers after K Removals
Find the least number of unique integers after removing exactly k elements from an array using efficient frequency count…
Minimum Number of Days to Make m Bouquets
Determine the minimum number of days required to make m bouquets using k adjacent flowers efficiently with binary search…
Making File Names Unique
This problem requires creating unique folder names by appending suffixes to duplicate names using an array scanning and …
Avoid Flood in The City
This problem asks you to avoid flooding by deciding when to dry lakes between rain events.
The kth Factor of n
Find the kth factor of n by scanning divisors carefully or using factor pairs to skip unnecessary checks.
Longest Subarray of 1's After Deleting One Element
Solve LeetCode 1493 by tracking runs of 1s around one deletion using a tight sliding window or state transition DP.
Check If Array Pairs Are Divisible by k
Check if array pairs are divisible by k by pairing elements whose sums are divisible by k using array scanning and hash …
Number of Subsequences That Satisfy the Given Sum Condition
Count all non-empty subsequences in an integer array where the sum of the minimum and maximum elements is at most a targ…
Last Moment Before All Ants Fall Out of a Plank
This problem involves simulating ant movement on a plank to determine the last moment before all ants fall off.
Count Submatrices With All Ones
Count Submatrices With All Ones is a dynamic programming problem focusing on submatrix counting using an efficient row-b…
Range Sum of Sorted Subarray Sums
Compute the sum of sorted subarray sums efficiently using binary search over valid sum ranges and prefix sum accumulatio…
Minimum Difference Between Largest and Smallest Value in Three Moves
Find the minimum difference between the largest and smallest values in an array after performing at most three moves.
Number of Substrings With Only 1s
Calculate the number of contiguous substrings containing only 1s in a binary string using a math and string approach eff…
Path with Maximum Probability
Find the path with the highest success probability in a graph from a start node to an end node, using edge probabilities…
Number of Nodes in the Sub-Tree With the Same Label
Compute the number of nodes in each subtree sharing the same label using DFS with hash table aggregation efficiently.
Number of Sub-arrays With Odd Sum
Count the number of subarrays with an odd sum using dynamic programming and prefix sum techniques.
Number of Good Ways to Split a String
Count all valid splits of a string where left and right substrings have equal distinct characters, using efficient state…
Minimum Suffix Flips
Find the minimum number of operations to convert a binary string to a target string using bit flips.
Number of Good Leaf Nodes Pairs
Find the number of good leaf node pairs in a binary tree where the shortest path between them is less than or equal to a…
Find the Winner of an Array Game
Determine the integer that wins an array game by achieving k consecutive victories through simulated pairwise comparison…
Minimum Swaps to Arrange a Binary Grid
Compute the minimum number of adjacent row swaps to transform a binary grid so all upper-triangle cells are zero using a…
Can Convert String in K Moves
Determine if string s can be transformed into t within k moves using character shifts and hash table counting efficientl…
Minimum Insertions to Balance a Parentheses String
Compute the minimum insertions to transform a parentheses string into a balanced string using efficient stack tracking.
Find Kth Bit in Nth Binary String
Determine the k-th bit in the n-th binary string using a recursive construction that inverts and reverses previous strin…
Maximum Number of Non-Overlapping Subarrays With Sum Equals Target
Find the maximum number of non-overlapping subarrays that sum to a given target using efficient scanning and hash lookup…
Minimum Operations to Make Array Equal
Compute the minimum number of operations to equalize a sequential odd-number array using a precise math-driven approach.
Magnetic Force Between Two Balls
Maximize the minimum magnetic force between balls by strategically placing them in baskets using binary search on positi…
Minimum Number of Vertices to Reach All Nodes
Identify the minimum set of vertices in a directed acyclic graph from which all nodes are reachable efficiently using gr…
Minimum Numbers of Function Calls to Make Target Array
Calculate the minimum number of modify calls needed to convert an all-zero array into a given target array using greedy …
Detect Cycles in 2D Grid
Detect cycles in a 2D character grid using DFS while carefully tracking parent cells to avoid invalid revisits.
Maximum Number of Coins You Can Get
Solve the Maximum Number of Coins You Can Get using greedy pile selection and invariant validation to maximize your coin…
Find Latest Group of Size M
Determine the latest step where a contiguous group of ones of exact length m exists using array scanning and hash tracki…
Maximum Length of Subarray With Positive Product
Given an array, find the maximum length of a subarray with a positive product using dynamic programming.
Number of Ways to Split a String
Count the number of ways to split a binary string into three non-empty parts with equal numbers of '1's.
Shortest Subarray to be Removed to Make Array Sorted
Find the shortest subarray to remove in order to make an array non-decreasing using binary search and two-pointer techni…
Number of Ways Where Square of Number Is Equal to Product of Two Numbers
Find the number of triplets where the square of a number equals the product of two others, utilizing array scanning and …
Minimum Time to Make Rope Colorful
Minimize the time Bob needs to remove balloons to make a rope colorful using dynamic programming with state transitions.
Count Unhappy Friends
Determine the number of unhappy friends in paired arrangements using array-based simulation for preference violations.
Min Cost to Connect All Points
Min Cost to Connect All Points asks for the minimum cost to connect all points on a 2D plane, using manhattan distances …
Maximum Sum Obtained of Any Permutation
Maximize the total sum of requests on nums by greedily assigning larger numbers to most frequently requested indices.
Make Sum Divisible by P
Determine the minimum-length subarray to remove so the remaining array sum is divisible by a given integer p efficiently…
Split a String Into the Max Number of Unique Substrings
Maximize unique substrings in a string using backtracking with pruning and hash tables to track substrings.
Maximum Non Negative Product in a Matrix
Find the maximum non-negative product path in a matrix using dynamic programming and state transition.
Maximum Profit of Operating a Centennial Wheel
Maximize the profit from operating a Centennial Wheel by determining the optimal number of rotations based on customer a…
Throne Inheritance
Throne Inheritance requires modeling a dynamic family tree with births and deaths to determine the kingdom's inheritance…
Alert Using Same Key-Card Three or More Times in a One Hour Period
Solve LeetCode 1604 by grouping swipe times per employee, sorting each list, and scanning for any three within 60 minute…
Find Valid Matrix Given Row and Column Sums
Given row and column sums, find any valid matrix of non-negative integers that satisfies them.
Even Odd Tree
Determine if a binary tree meets Even-Odd rules by checking value parity and strict ordering at each level efficiently.
Maximal Network Rank
Calculate the maximum network rank of two cities by analyzing all city pairs using a graph-driven solution strategy effi…
Split Two Strings to Make Palindrome
Determine if splitting two equal-length strings at a common index can form a palindrome using two-pointer scanning techn…
Coordinate With Maximum Network Quality
Determine the coordinate with the maximum network quality by summing signal strengths from all reachable towers efficien…
Number of Sets of K Non-Overlapping Line Segments
Count all valid arrangements of k non-overlapping line segments on n points using state transition dynamic programming.
Lexicographically Smallest String After Applying Operations
Optimize a string through rotations and additions to get the lexicographically smallest possible result using string man…
Best Team With No Conflicts
Find the highest score basketball team by choosing players without conflicts in age and score using dynamic programming.
Arithmetic Subarrays
Determine whether subarrays of a given array can be rearranged to form arithmetic sequences using array scanning and has…
Path With Minimum Effort
Find the minimum effort required to travel from the top-left to the bottom-right of a grid, considering height differenc…
Count Substrings That Differ by One Character
Count all substrings from s that differ by exactly one character from some substring in t using precise substring compar…
Count Sorted Vowel Strings
Calculate the number of length-n strings with vowels only that are sorted lexicographically using state transitions.
Furthest Building You Can Reach
Furthest Building You Can Reach explores a greedy approach with heap-based optimization to find the maximum reachable bu…
Minimum Deletions to Make Character Frequencies Unique
Determine the minimum deletions needed to ensure all character frequencies in a string are unique using a greedy approac…
Sell Diminishing-Valued Colored Balls
Maximize total value by greedily selling diminishing-valued colored balls based on inventory and customer orders.
Minimum Deletions to Make String Balanced
Determine the minimum number of deletions to transform a string of 'a' and 'b' into a balanced order using DP.
Minimum Jumps to Reach Home
Find the minimum number of jumps needed to reach a target position while avoiding forbidden positions.
Determine if Two Strings Are Close
Check if two strings can transform into each other using letter swaps and frequency reorganizations, leveraging hash tab…
Minimum Operations to Reduce X to Zero
Find the minimum number of operations to reduce a value x to zero by removing elements from an array.
Smallest String With A Given Numeric Value
Find the lexicographically smallest string of length n with a given numeric value k using a greedy approach.
Ways to Make a Fair Array
Solve Ways to Make a Fair Array by tracking parity sums before and after each removal with prefix-sum style accounting.
Merge In Between Linked Lists
Merge a second linked list into a first by removing a specified range of nodes, testing precise pointer updates and list…
Design Front Middle Back Queue
Implement a queue that efficiently handles push and pop operations at the front, middle, and back using pointer manipula…
Find the Most Competitive Subsequence
Identify the lexicographically smallest subsequence of size k using stack-based greedy selection in array traversal.
Minimum Moves to Make Array Complementary
Find the minimum moves to make an array complementary by analyzing paired sums and using hash lookups for efficiency.
Max Number of K-Sum Pairs
Max Number of K-Sum Pairs is a problem involving counting disjoint pairs with a given sum k in an array.
Concatenation of Consecutive Binary Numbers
Calculate the decimal value of concatenated binary numbers from 1 to n using efficient bit manipulation techniques.
Sum of Absolute Differences in a Sorted Array
Calculate the sum of absolute differences between each element and others in a sorted array efficiently.
Stone Game VI
Determine the winner in Stone Game VI using a greedy strategy that accounts for each stone's dual value impact on Alice …
Partitioning Into Minimum Number Of Deci-Binary Numbers
This problem asks to find the minimum number of deci-binary numbers needed to sum to a given number represented as a str…
Stone Game VII
Maximize score difference in a two-player turn-based stone removal game using state transition dynamic programming.
Maximum Erasure Value
Maximize the score by erasing a subarray with unique elements in an array of integers.
Jump Game VI
Jump Game VI challenges you to maximize your score while jumping through an array using state transition dynamic program…
Average Waiting Time
Compute the average waiting time for customers using array traversal and simulation of a single chef processing orders s…
Maximum Binary String After Change
The problem asks to maximize a binary string using specific operations to get the highest possible value.
Maximum Number of Eaten Apples
Maximize apples eaten by choosing the best apples first, considering their rot days and available days to eat them.
Where Will the Ball Fall
Determine where each ball exits a diagonal board grid or if it gets stuck, using matrix simulation with careful traversa…
Count Good Meals
Count Good Meals asks you to find pairs of food items with a sum of deliciousness equal to a power of two.
Ways to Split Array Into Three Subarrays
The problem requires finding the number of ways to split an array into three subarrays where each split meets a certain …
Maximum Score From Removing Substrings
Compute the highest score by greedily removing specific substrings using a stack to track state transitions efficiently.
Construct the Lexicographically Largest Valid Sequence
Construct the Lexicographically Largest Valid Sequence problem involves finding the largest sequence with backtracking a…
Swapping Nodes in a Linked List
Swap nodes in a linked list using linked-list pointer manipulation and two pointers to solve this medium difficulty prob…
Minimize Hamming Distance After Swap Operations
Solve Minimize Hamming Distance After Swap Operations by grouping swappable indices and matching value counts inside eac…
Tuple with Same Product
Given an array of distinct integers, return the number of tuples where the product of two pairs is the same.
Largest Submatrix With Rearrangements
Rearrange columns of a binary matrix to find the largest submatrix of 1s.
Minimum Number of People to Teach
Minimize the number of users to teach a language that ensures all friends can communicate in a social network.
Decode XORed Permutation
Decode XORed Permutation uses prefix reconstruction with global XOR to recover the hidden odd-length permutation in line…
Change Minimum Characters to Satisfy One of Three Conditions
This problem asks for the minimum operations to change two strings so that one of three conditions is met.
Find Kth Largest XOR Coordinate Value
Compute the kth largest XOR coordinate in a 2D matrix using prefix sums, bit manipulation, and optimized selection techn…
Restore the Array From Adjacent Pairs
Restore the Array From Adjacent Pairs reconstructs a sequence using adjacent element pairs. Efficient hash lookups and a…
Can You Eat Your Favorite Candy on Your Favorite Day?
Determine if you can eat a candy of your favorite type on a specific day, given daily limits and candy availability.
Maximum Absolute Sum of Any Subarray
Solve for the maximum absolute sum of any subarray using dynamic programming and understanding state transitions.
Minimum Length of String After Deleting Similar Ends
Minimize string length by deleting similar characters from both ends repeatedly using a two-pointer technique.
Maximum Score From Removing Stones
Maximize the score in a solitaire game by optimally removing stones from three piles with a greedy approach.
Largest Merge Of Two Strings
Construct the lexicographically largest merge from two strings using a two-pointer greedy scanning approach efficiently.
Count Number of Homogenous Substrings
This problem requires counting all homogenous substrings in a given string and returning the result modulo 10^9 + 7.
Minimum Limit of Balls in a Bag
Find the minimum penalty (maximum balls in a bag) after performing up to maxOperations to split bags of balls.
Form Array by Concatenating Subarrays of Another Array
Determine if you can sequentially select disjoint subarrays from nums matching each group in order using two-pointer sca…
Map of Highest Peak
Solve the Map of Highest Peak problem using breadth-first search to assign heights based on proximity to water cells.
Minimum Number of Operations to Move All Balls to Each Box
Solve the problem of finding the minimum operations to move balls to each box using an efficient approach with arrays an…
Closest Dessert Cost
Find the closest dessert cost to a target by selecting from a list of base flavors and topping combinations using dynami…
Equal Sum Arrays With Minimum Number of Operations
Solve the problem of balancing the sums of two integer arrays with minimal operations, using array scanning and hash loo…
Check if Number is a Sum of Powers of Three
Determine if a number can be expressed as the sum of distinct powers of three using a math-driven strategy.
Sum of Beauty of All Substrings
Calculate the total beauty of all substrings by counting character frequencies and computing frequency differences effic…
Minimum Elements to Add to Form a Given Sum
Compute the gap between current sum and goal, then greedily cover it with limit-sized additions to get the minimum count…
Number of Restricted Paths From First to Last Node
Solve the problem of finding the number of restricted paths in a weighted undirected graph, leveraging graph algorithms …
Maximum Average Pass Ratio
Maximize the average pass ratio by assigning extra guaranteed-passing students using a greedy heap strategy for optimal …
Design Authentication Manager
Implement an AuthenticationManager using linked-list pointer manipulation and a hash map to track token expirations effi…
Maximum Number of Consecutive Values You Can Make
Find the maximum number of consecutive integer values starting from zero that can be formed using your coins array.
Number of Orders in the Backlog
Determine the total number of unfulfilled buy and sell orders using heaps to simulate backlog processing efficiently in …
Maximum Value at a Given Index in a Bounded Array
Maximize the value at a given index of an array with constraints using binary search over the valid answer space.
Minimum Number of Operations to Reinitialize a Permutation
Find the minimum number of operations to reinitialize a permutation of size n using specific operations.
Evaluate the Bracket Pairs of a String
Quickly evaluate a string with bracketed keys using array scanning and hash table lookups for efficient replacements.
Sentence Similarity III
Sentence Similarity III asks if one sentence can be transformed into another by inserting a sentence inside it.
Count Nice Pairs in an Array
Count Nice Pairs in an Array requires efficiently pairing numbers where nums[i] + rev(nums[j]) equals nums[j] + rev(nums…
Finding the Users Active Minutes
This problem requires counting unique minutes of user activity on LeetCode based on a series of logs and an integer k.
Minimum Absolute Sum Difference
Minimize the absolute sum difference between two integer arrays by replacing at most one element from the first array.
Find the Winner of the Circular Game
Find the winner of a circular game by simulating the elimination process with a queue-driven approach.
Minimum Sideway Jumps
Solve the Minimum Sideway Jumps problem using state transition dynamic programming to minimize side jumps while navigati…
Queries on Number of Points Inside a Circle
Determine how many 2D points lie within multiple circles using array iteration and Euclidean distance calculations effic…
Maximum XOR for Each Query
Find the maximum XOR for each query based on a sorted array and bit manipulation.
Maximum Ice Cream Bars
Maximize the number of ice cream bars a boy can buy by applying a greedy choice strategy based on cost sorting.
Single-Threaded CPU
Simulate task processing with a single-threaded CPU by sorting and prioritizing tasks based on arrival and processing ti…
Frequency of the Most Frequent Element
Maximize the frequency of an element in an array by incrementing at most `k` elements. Use binary search and greedy tech…
Longest Substring Of All Vowels in Order
Find the longest substring of all vowels in order within a given string of vowels using sliding window technique.
Seat Reservation Manager
Manage seat reservations efficiently using a design combining priority queue to always return the lowest available seat …
Maximum Element After Decreasing and Rearranging
Determine the maximum value in an array after decreasing elements and rearranging using a greedy invariant approach.
Splitting a String Into Descending Consecutive Values
Check if a string of digits can be split into descending consecutive values where the difference between them is 1.
Minimum Adjacent Swaps to Reach the Kth Smallest Number
Find the minimum number of adjacent swaps to reach the kth smallest wonderful integer from a given number string.
Maximum Distance Between a Pair of Values
Find the maximum distance between a pair of values in two non-increasing integer arrays using binary search.
Maximum Subarray Min-Product
The problem asks to find the maximum min-product of any non-empty subarray of nums.
Incremental Memory Leak
Solve Incremental Memory Leak by simulating each second carefully and using math to reason about the crash time bound.
Rotating the Box
Rotate a box represented by a character matrix, letting stones fall under gravity using precise two-pointer scanning and…
Minimum Number of Swaps to Make the Binary String Alternating
This problem requires finding the minimum number of swaps to make a binary string alternating or determine if it's impos…
Finding Pairs With a Certain Sum
Efficiently track and count pairs across two arrays using array scanning plus hash lookup to support dynamic updates.
Minimum Speed to Arrive on Time
This problem asks to find the minimum speed of trains to reach on time using binary search.
Jump Game VII
The problem asks to determine if we can reach the last index of a binary string, with a set range of jumps between indic…
Minimize Maximum Pair Sum in Array
Minimize the maximum pair sum in an array by optimally pairing its elements.
Get Biggest Three Rhombus Sums in a Grid
Find the three largest distinct rhombus sums from a given grid using array and math techniques.
Maximum Value after Insertion
Solve Maximum Value after Insertion by greedily placing x at the first digit that makes the resulting signed number larg…
Process Tasks Using Servers
Assign tasks to servers efficiently using arrays and heaps, resolving ties by weight and index while tracking availabili…
Egg Drop With 2 Eggs and N Floors
Determine the minimum drops needed to find the critical floor using 2 eggs with optimized state transition dynamic progr…
Reduction Operations to Make the Array Elements Equal
Find the minimum number of operations to make all array elements equal by reducing the largest elements to the next smal…
Minimum Number of Flips to Make the Binary String Alternating
Find the minimum number of flips to make a binary string alternate, using state transition dynamic programming.
Find the Student that Will Replace the Chalk
Identify the first student who will run out of chalk using a simulation with prefix sums and binary search.
Largest Magic Square
Find the side length of the largest magic square in a matrix where row, column, and diagonal sums are equal.
Maximum Number of Removable Characters
Use binary search and a subsequence check to find the largest removable prefix that still keeps p inside s.
Merge Triplets to Form Target Triplet
Determine if target triplet can be formed by merging given triplets using greedy selection and invariant checks.
Find a Peak Element II
Locate any peak in a 2D matrix using binary search across rows or columns for efficient discovery and verification.
The Number of Full Rounds You Have Played
Solve this math plus string problem to calculate the number of full rounds played in a chess tournament between login an…
Count Sub Islands
Identify and count all islands in grid2 that are fully contained within islands of grid1 using DFS traversal efficiently…
Minimum Absolute Difference Queries
Compute minimum absolute differences for subarrays efficiently using array scanning and hash table lookups, leveraging b…
Remove All Occurrences of a Substring
Remove all occurrences of a specified substring from a string using efficient stack-based state management.
Maximum Alternating Subsequence Sum
Maximize alternating subsequence sum with dynamic programming and state transitions in an array.
Cyclically Rotating a Grid
This problem requires cyclically rotating a grid by rotating each layer of the matrix counter-clockwise for a specified …
Number of Wonderful Substrings
Count the number of wonderful non-empty substrings of a given string based on frequency conditions of characters.
Eliminate Maximum Number of Monsters
Eliminate monsters by strategically using a weapon in a video game to stop them before they reach your city.
Count Good Numbers
Count Good Numbers uses a mathematical pattern with recursion to efficiently count digit strings of length n under stric…
Nearest Exit from Entrance in Maze
Find the shortest path from the maze entrance to the nearest border exit using BFS over a 2D array matrix efficiently.
Sum Game
Determine if Alice can force a win in the Sum Game by strategically replacing '?' using a greedy and invariant approach.
Unique Length-3 Palindromic Subsequences
Count all unique length-3 palindromic subsequences in a string efficiently using hash tables and character positions.
Add Minimum Number of Rungs
Determine the fewest rungs to add to climb a strictly increasing ladder using a greedy step-by-step approach.
Maximum Number of Points with Cost
Maximize your points in a matrix by selecting cells row by row while accounting for distance penalties using dynamic pro…
The Number of the Smallest Unoccupied Chair
Solve The Number of the Smallest Unoccupied Chair by sorting arrivals and managing freed seats before each new assignmen…
Describe the Painting
Solve the problem of describing a painted segment with mixed colors using array scanning and hash table lookups.
Largest Number After Mutating Substring
Find the largest integer by mutating a substring of a number using a mapping array for each digit.
Maximum Compatibility Score Sum
Assign students to mentors to maximize total compatibility using state transition dynamic programming with bitmask optim…
Maximum Number of Weeks for Which You Can Work
Maximize the number of weeks you can work on projects with milestone constraints using a greedy approach and invariant v…
Minimum Garden Perimeter to Collect Enough Apples
Find the minimum perimeter of a square garden that holds enough apples based on a specific formula involving binary sear…
Check if Move is Legal
Determine if a move on an 8x8 board is legal by validating lines in all directions using array and matrix patterns.
Minimum Total Space Wasted With K Resizing Operations
Find the minimum total space wasted in a dynamic array with at most k resizing operations.
Remove Stones to Minimize the Total
Minimize the total stones by repeatedly removing half from the largest pile using a greedy heap strategy.
Minimum Number of Swaps to Make the String Balanced
Determine the minimum swaps to balance a bracket string using two-pointer scanning with invariant tracking efficiently.
Array With Elements Not Equal to Average of Neighbors
Rearrange an array such that no element equals the average of its neighbors using a greedy approach.
Minimum Non-Zero Product of the Array Elements
The problem asks to minimize the product of an array after performing bit-swapping operations on its binary representati…
Maximum Matrix Sum
Maximize the sum of an n x n integer matrix using row and column negation operations efficiently with a greedy approach.
Number of Ways to Arrive at Destination
Find the number of ways to travel from intersection 0 to n - 1 in the shortest time, using a graph-based approach.
Find Unique Binary String
Find a binary string of length n not in the input array using array scanning and hash lookup efficiently.
Minimize the Difference Between Target and Chosen Elements
This problem asks to select one element per row to minimize the absolute difference from a target sum using dynamic prog…
Find the Kth Largest Integer in the Array
This problem asks to find the kth largest integer in an array of string numbers, highlighting sorting and string-based c…
Minimum Number of Work Sessions to Finish the Tasks
Find the minimum number of work sessions needed to finish a set of tasks, considering task durations and session time.
Find All Groups of Farmland
Identify all rectangular farmland groups in a binary matrix using array traversal and depth-first search efficiently.
Operations on Tree
Design a tree data structure that allows locking, unlocking, and upgrading nodes with user-specific actions.
The Number of Weak Characters in the Game
Identify all weak characters in a game by analyzing attack and defense values using a stack-based greedy sorting approac…
First Day Where You Have Been in All the Rooms
Calculate the first day you have visited all rooms using state transition dynamic programming on the nextVisit array.
Number of Pairs of Interchangeable Rectangles
Count all pairs of rectangles that share the exact width-to-height ratio using efficient array scanning and hash lookup.
Maximum Product of the Length of Two Palindromic Subsequences
Find two disjoint palindromic subsequences in a string to maximize the product of their lengths efficiently using dynami…
Find Original Array From Doubled Array
Given a shuffled array, determine if it is a doubled array and find the original array.
Maximum Earnings From Taxi
Maximize earnings by optimizing taxi ride selection and tips using array scanning, hash lookups, and sorting.
Sum of Beauty in the Array
Calculate the sum of beauty for array elements using prefix and suffix tracking to optimize evaluation across indices ef…
Detect Squares
Detect Squares requires tracking points on a 2D plane to quickly count all possible axis-aligned squares using efficient…
Grid Game
Solve the Grid Game problem by optimizing the movement of two robots on a 2D matrix grid.
Check if Word Can Be Placed In Crossword
Determine if a word fits in a crossword grid using array and matrix checks, accounting for spaces, letters, and blocked …
Number of Pairs of Strings With Concatenation Equal to Target
Count all unique index pairs in a string array whose concatenation exactly matches the given target string using efficie…
Maximize the Confusion of an Exam
Maximize the Confusion of an Exam requires adjusting at most k answers to create the longest consecutive true or false s…
Find Missing Observations
Given a set of dice rolls, calculate the missing observations based on the mean and return them or determine if it's imp…
Stone Game IX
In the Stone Game IX problem, Alice and Bob take turns removing stones, and Alice wins if the sum of removed stones is d…
Minimum Operations to Make a Uni-Value Grid
Determine the fewest additions or subtractions of x to make all grid elements identical using array and math logic.
Stock Price Fluctuation
Design an efficient algorithm for managing stock price fluctuations with incorrect and unordered data in a data stream.
Remove Colored Pieces if Both Neighbors are the Same Color
Alice and Bob play a game removing colored pieces; Alice wins if she makes the last valid move.
The Time When the Network Becomes Idle
Calculate the time when the network becomes idle, factoring in message resending and the BFS traversal method.
Simple Bank System
Design a simple bank system that processes transactions like withdrawals, deposits, and transfers while managing account…
Count Number of Maximum Bitwise-OR Subsets
Determine the number of non-empty subsets that achieve the maximum bitwise OR using efficient backtracking and pruning s…
Next Greater Numerically Balanced Number
Find the smallest numerically balanced number greater than a given integer using backtracking search and pruning.
Count Nodes With the Highest Score
Find the number of nodes with the highest score in a binary tree, based on subtree sizes and node removal.
Two Best Non-Overlapping Events
Maximize the total value of at most two non-overlapping events using state transition dynamic programming efficiently.
Plates Between Candles
Determine the number of plates between candles in a given substring using binary search and prefix sum techniques.
Find the Minimum and Maximum Number of Nodes Between Critical Points
Find the minimum and maximum number of nodes between critical points in a linked list by identifying local minima and ma…
Minimum Operations to Convert Number
Determine the minimum operations needed to convert a number using array elements with addition, subtraction, or XOR oper…
Vowels of All Substrings
Compute the total number of vowels in all substrings of a given string using efficient state transition dynamic programm…
Minimized Maximum of Products Distributed to Any Store
Distribute products to stores so the largest store allocation is minimized using binary search over possible maximums.
Walking Robot Simulation II
The Walking Robot Simulation II problem challenges you to simulate robot movements and track its position and direction …
Most Beautiful Item for Each Query
Determine the maximum beauty of items affordable for each query using efficient binary search and sorting techniques.
Reverse Nodes in Even Length Groups
Reverse nodes in even length groups while keeping the odd-length groups intact in a given linked list.
Decode the Slanted Ciphertext
Decode the Slanted Ciphertext problem requires decoding a slanted cipher using string manipulation and simulation based …
Watering Plants
Simulate watering plants while managing a watering can's capacity, considering distance and refills.
Range Frequency Queries
Design a data structure to handle efficient frequency queries for subarrays, focusing on hash-based lookups and efficien…
Minimum Number of Food Buckets to Feed the Hamsters
Find the minimum number of food buckets required to feed all hamsters, using dynamic programming and greedy techniques.
Minimum Cost Homecoming of a Robot in a Grid
Find the minimum cost for a robot to return home in a grid with row and column movement costs.
K Radius Subarray Averages
Efficiently calculate the k-radius average for subarrays using sliding window technique.
Removing Minimum and Maximum From Array
The problem asks to remove the minimum and maximum elements from an array with the fewest deletions.
Delete the Middle Node of a Linked List
Efficiently remove the middle node from a linked list using two-pointer techniques and careful pointer updates to mainta…
Step-By-Step Directions From a Binary Tree Node to Another
Find the shortest path between two nodes in a binary tree and output the directions as a string of 'L', 'R', and 'U'.
Find Good Days to Rob the Bank
Find good days to rob the bank by identifying days with non-increasing and non-decreasing guard counts using dynamic pro…
Detonate the Maximum Bombs
Determine the maximum number of bombs that can be detonated by leveraging chain reactions using graph traversal and DFS …
Sum of Subarray Ranges
Compute the total sum of ranges for all contiguous subarrays efficiently using stack-based state management techniques.
Watering Plants II
Simulate watering a row of plants with Alice and Bob using two-pointer scanning, tracking refills precisely for each ste…
Adding Spaces to a String
Learn to efficiently insert spaces in a string using two-pointer scanning with invariant tracking in linear time.
Number of Smooth Descent Periods of a Stock
Count all contiguous periods where stock prices descend smoothly by exactly one using dynamic programming techniques.
Find All Possible Recipes from Given Supplies
Determine all recipes you can prepare given initial supplies and ingredient dependencies, leveraging array scanning and …
Check if a Parentheses String Can Be Valid
Determine if a parentheses string can be transformed into a valid sequence considering locked positions using stack logi…
Execution of All Suffix Instructions Staying in a Grid
Simulate robot moves from every instruction index on an n x n grid, counting valid steps without leaving boundaries.
Intervals Between Identical Elements
Solve the problem of calculating intervals between identical elements using array scanning and hash lookup.
Number of Laser Beams in a Bank
Calculate total laser beams in a bank floor plan using array counting and math logic between security devices on differe…
Destroying Asteroids
This problem requires destroying asteroids by choosing the right order of collisions based on mass, using a greedy appro…
Maximum Twin Sum of a Linked List
Find the maximum twin sum in a linked list by manipulating pointers efficiently and leveraging stack or reversal techniq…
Longest Palindrome by Concatenating Two Letter Words
Find the maximum-length palindrome by combining two-letter words using array scanning and hash table lookups efficiently…
Minimum Swaps to Group All 1's Together II
Solve the minimum swaps to group all 1's together in a circular binary array using an optimized sliding window approach.
Count Words Obtained After Adding a Letter
Given startWords and targetWords, check how many targetWords can be formed by adding one letter and rearranging letters …
Minimum Moves to Reach Target Score
Calculate the fewest steps to reach a target integer using increments and limited doubles with a greedy strategy.
Solving Questions With Brainpower
Maximize points in an exam with state transition dynamic programming by deciding whether to solve or skip each question.
Count the Hidden Sequences
Given a sequence of differences, count how many hidden sequences fit within a range using an array and prefix sum approa…
K Highest Ranked Items Within a Price Range
Use BFS to rank reachable shop items by distance, price, row, and column, then return the best k coordinates.
Rearrange Array Elements by Sign
Rearrange an array by alternating positive and negative integers using a two-pointer approach with invariant tracking.
Find All Lonely Numbers in the Array
Find lonely numbers in an array where each lonely number appears once and has no adjacent values.
All Divisions With the Highest Score of a Binary Array
Find all indices in a binary array where division score is maximized.
Partition Array According to Given Pivot
Rearrange an array around a pivot while maintaining relative order using a two-pointer scanning approach efficiently.
Minimum Cost to Set Cooking Time
Calculate the minimum fatigue to set a microwave cooking time using digit moves and pushes efficiently.
Smallest Value of the Rearranged Number
Rearrange the digits of an integer to minimize its value while avoiding leading zeros, keeping the sign unchanged.
Design Bitset
Master the Design Bitset problem by efficiently managing bit flips, counts, and indexed updates with array and hash look…
Minimum Operations to Make the Array Alternating
Given an array, calculate the minimum number of operations needed to make it alternating.
Removing Minimum Number of Magic Beans
Determine the minimum beans to remove so all remaining non-empty bags have equal beans using a greedy approach.
Find Three Consecutive Integers That Sum to a Given Number
Given a number, find three consecutive integers that sum to it, or return an empty array if no such integers exist.
Maximum Split of Positive Even Integers
Determine the largest set of unique positive even integers that sum to a given finalSum using backtracking and greedy se…
Merge Nodes in Between Zeros
This problem requires merging nodes between zeros in a linked list by summing up the values between consecutive zeros.
Construct String With Repeat Limit
Construct a lexicographically largest string from a given string with no letter appearing more than a repeatLimit times …
Minimum Number of Steps to Make Two Strings Anagram II
Compute the fewest character insertions needed to turn two strings into anagrams using hash table frequency counts effic…
Minimum Time to Complete Trips
Find the minimum time required for buses to complete at least totalTrips using binary search over time multiples.
Sort the Jumbled Numbers
Sort numbers based on a custom mapping of their digits, leveraging array manipulation and sorting techniques.
All Ancestors of a Node in a Directed Acyclic Graph
Solve the All Ancestors of a Node in a Directed Acyclic Graph problem using graph traversal techniques like BFS, DFS, an…
Append K Integers With Minimal Sum
In this problem, you need to append k unique positive integers to a given array nums such that the sum is minimized.
Create Binary Tree From Descriptions
Build a binary tree from descriptions of parent-child relationships using array scanning and hash lookup.
Count Artifacts That Can Be Extracted
Count the number of artifacts that can be extracted after excavating specified grid cells.
Maximize the Topmost Element After K Moves
Maximize the topmost element in a pile after making exactly k moves using a greedy strategy and invariant checks.
Maximize Number of Subsequences in a String
Maximize the number of subsequences by optimally adding a character to a given string to match a specified pattern.
Minimum Operations to Halve Array Sum
Minimize operations to halve an array's sum using greedy choices and heap data structures.
Count Collisions on a Road
Count Collisions on a Road is a problem where you calculate the number of car collisions based on their movements in a s…
Maximum Points in an Archery Competition
In the "Maximum Points in an Archery Competition" problem, Bob aims to maximize his score while respecting Alice's arrow…
Minimum Deletions to Make Array Beautiful
Determine the minimum deletions required to transform an array into a beautiful sequence using stack-based state managem…
Find Palindrome With Fixed Length
Find the smallest palindromes of a given length for specific queries with mathematical and array manipulation.
Find Triangular Sum of an Array
The problem asks for calculating the triangular sum of an array through repeated pairwise summation.
Number of Ways to Select Buildings
Solve Number of Ways to Select Buildings by counting alternating 3-building patterns with state transitions over the bin…
Find Players With Zero or One Losses
Identify players with zero or one losses by efficiently scanning arrays and counting losses using hash lookups for accur…
Maximum Candies Allocated to K Children
Maximize candies allocation for k children by dividing piles into sub-piles using binary search.
Minimize Result by Adding Parentheses to Expression
Enumerate every valid parenthesis placement around the plus sign and choose the expression with the smallest evaluated p…
Maximum Product After K Increments
Maximize the product of an array after performing up to k increments using a greedy approach with heap optimization.
Number of Ways to Buy Pens and Pencils
Calculate all distinct ways to spend a fixed total on pens and pencils using a straightforward enumeration strategy.
Design an ATM Machine
Design an ATM machine that stores and withdraws money with given denominations and prioritizes larger values during with…
Minimum Rounds to Complete All Tasks
The problem requires finding the minimum rounds to complete tasks, focusing on greedy algorithms and hash table lookups.
Maximum Trailing Zeros in a Cornered Path
Find the maximum trailing zeros in the product of a cornered path within a 2D grid.
Count Lattice Points Inside a Circle
Count the number of lattice points inside at least one circle in a grid, based on given center and radius data.
Count Number of Rectangles Containing Each Point
Given a set of rectangles and points, determine how many rectangles contain each point.
Minimum Average Difference
Find the index with the minimum average difference in an array using prefix sums.
Count Unguarded Cells in the Grid
Solve Count Unguarded Cells in the Grid by marking guard sight lines across a blocked matrix and counting untouched empt…
Minimum Consecutive Cards to Pick Up
Solve Minimum Consecutive Cards to Pick Up by tracking each card's last index and minimizing duplicate spans during one …
K Divisible Elements Subarrays
Count all distinct subarrays with at most k elements divisible by p using array scanning and hash lookup techniques effi…
Count Nodes Equal to Average of Subtree
Given a binary tree, count nodes where the value equals the average of values in its subtree.
Count Number of Texts
Calculate the total number of possible original texts from a pressed key sequence using state transition dynamic program…
Number of Ways to Split Array
Count all valid ways to split a 0-indexed integer array into two non-empty parts using array plus prefix sum logic effic…
Maximum White Tiles Covered by a Carpet
Solve Maximum White Tiles Covered by a Carpet by sorting intervals, checking optimal carpet starts, and counting full pl…
Maximum Consecutive Floors Without Special Floors
Find the maximum sequence of consecutive floors without any special floors using array sorting techniques efficiently.
Largest Combination With Bitwise AND Greater Than Zero
Find the largest group of integers in an array whose bitwise AND is greater than zero using array scanning and hash look…
Maximum Bags With Full Capacity of Rocks
Maximize the number of bags filled to capacity by distributing additional rocks using a greedy approach.
Minimum Lines to Represent a Line Chart
Determine the fewest lines needed to accurately connect stock price points in a line chart using array and math reasonin…
Sender With Largest Word Count
Find the sender with the largest total word count by scanning messages and tallying counts using a hash table efficientl…
Maximum Total Importance of Roads
Assign unique values to cities to maximize the total importance of all roads using greedy selection based on city connec…
Apply Discount to Prices
Apply Discount to Prices involves updating a sentence by applying a percentage discount to price words, with precise for…
Steps to Make Array Non-decreasing
Determine the minimum steps to make an array non-decreasing using linked-list pointer manipulation and monotonic stack t…
Partition Array Such That Maximum Difference Is K
Find the minimum number of subsequences required such that the difference between the maximum and minimum value in each …
Replace Elements in an Array
Replace Elements in an Array involves applying a series of operations to replace values in an array with new ones based …
Successful Pairs of Spells and Potions
Count how many potions pair successfully with each spell using binary search over sorted potion strengths efficiently.
Minimum Path Cost in a Grid
Minimize the cost of a path in a grid while considering move costs for each step.
Fair Distribution of Cookies
The problem focuses on fairly distributing cookies among children to minimize the maximum unfairness of the distribution…
Sum of Numbers With Units Digit K
Determine the minimum set of positive integers whose units digits match k and sum exactly to num using DP patterns.
Longest Binary Subsequence Less Than or Equal to K
Find the longest subsequence in a binary string that forms a number less than or equal to a given integer k.
Count Unreachable Pairs of Nodes in an Undirected Graph
Calculate the total number of node pairs in an undirected graph that cannot reach each other using DFS, BFS, or Union Fi…
Maximum XOR After Operations
Maximize the bitwise XOR of an array after applying a special operation with non-negative integers multiple times.
Count Number of Ways to Place Houses
This problem asks you to calculate the number of ways to place houses along a street while preventing adjacent houses on…
Spiral Matrix IV
In this problem, you need to generate a matrix filled with values from a linked list in a spiral order.
Number of People Aware of a Secret
Calculate how many people know a secret over n days using state transition dynamic programming and careful simulation of…
The Latest Time to Catch a Bus
Find the latest time to catch a bus based on departure times, passenger arrivals, and capacity using binary search over …
Minimum Sum of Squared Difference
Calculate the minimum sum of squared differences between two arrays using limited modifications and binary search techni…
Smallest Number in Infinite Set
Design a data structure to handle the smallest missing element in an infinite set, with the ability to add and remove el…
Move Pieces to Obtain a String
Determine if the pieces in start can be moved to form target using two-pointer scanning and strict left-right movement r…
Max Sum of a Pair With Equal Sum of Digits
Find the maximum sum of two numbers with equal digit sums in a given array of positive integers.
Query Kth Smallest Trimmed Number
Solve the Query Kth Smallest Trimmed Number problem by efficiently trimming and sorting strings in an array to answer qu…
Number of Zero-Filled Subarrays
Given an array of integers, count the subarrays that consist entirely of 0s.
Design a Number Container System
Learn to implement a Number Container System using hash tables and design techniques to efficiently track numbers and in…
Equal Row and Column Pairs
Identify all pairs of rows and columns in a square matrix that contain identical elements in the same sequence efficient…
Design a Food Rating System
Design a food rating system that tracks and updates ratings of foods, finding the highest rated items by cuisine.
Maximum Number of Groups Entering a Competition
Determine the maximum number of ordered non-empty student groups for a competition using grades array analysis and binar…
Find Closest Node to Given Two Nodes
Find the node that minimizes the maximum distance to two given nodes in a directed graph with one outgoing edge per node…
Count Number of Bad Pairs
Count the number of bad pairs in an array where the difference between indices and values does not match.
Task Scheduler II
Complete tasks in the optimal number of days by considering breaks and task type constraints.
Reachable Nodes With Restrictions
In the 'Reachable Nodes With Restrictions' problem, find the maximum reachable nodes from node 0 in a tree while avoidin…
Check if There is a Valid Partition For The Array
This problem challenges you to determine if an array can be partitioned into valid subarrays using dynamic programming.
Longest Ideal Subsequence
The Longest Ideal Subsequence problem involves finding the longest subsequence where each character has a difference of …
Node With Highest Edge Score
Determine the node with the highest edge score in a graph using hash table aggregation and careful index tracking.
Construct Smallest Number From DI String
Construct the lexicographically smallest string that fits the increasing and decreasing conditions of a given pattern.
Time Needed to Rearrange a Binary String
Calculate the exact seconds required to convert all 01 pairs into 10 in a binary string using state transitions.
Shifting Letters II
Shift letters in a string using a sequence of range-based forward or backward operations efficiently with prefix sums.
Largest Palindromic Number
Form the largest palindromic number from a string of digits while maintaining a valid palindrome structure.
Amount of Time for Binary Tree to Be Infected
The problem asks to calculate the number of minutes for an infection to spread across all nodes in a binary tree startin…
Removing Stars From a String
Remove all stars from a string by simulating the removal process using a stack to manage characters and stars efficientl…
Minimum Amount of Time to Collect Garbage
This problem asks you to find the minimum amount of time needed to collect all garbage in a city, focusing on array and …
Strictly Palindromic Number
Determine if a number is strictly palindromic in all bases from 2 to n minus 2 using two-pointer scanning and invariant …
Maximum Rows Covered by Columns
Select exactly numSelect columns from a binary matrix to maximize rows where all ones are covered efficiently using back…
Number of Ways to Reach a Position After Exactly k Steps
Find the number of ways to reach a position after exactly k steps on an infinite number line using dynamic programming.
Longest Nice Subarray
Find the length of the longest nice subarray where the bitwise AND of all pairs of elements in the subarray is zero.
Optimal Partition of String
Given a string s, partition it into substrings with unique characters and return the minimum number of substrings.
Divide Intervals Into Minimum Number of Groups
Determine the minimum number of non-overlapping groups for a set of intervals using precise two-pointer scanning logic.
Maximum Matching of Players With Trainers
Maximize the number of valid player-trainer matchings using two-pointer scanning and careful sorting strategy.
Smallest Subarrays With Maximum Bitwise OR
Find the smallest subarrays with the maximum bitwise OR for each starting index in an array.
Length of the Longest Alphabetical Continuous Substring
Find the length of the longest continuous alphabetical substring from a given string of lowercase letters.
Reverse Odd Levels of Binary Tree
Reverse the node values at each odd level in a perfect binary tree, preserving the even levels.
Longest Subarray With Maximum Bitwise AND
Find the length of the longest subarray whose bitwise AND reaches the array's maximum value, combining array scanning wi…
Find All Good Indices
Identify all indices in an array where the k-length prefix is non-increasing and the k-length suffix is non-decreasing.
Longest Uploaded Prefix
Calculate the longest continuous uploaded prefix in a video stream efficiently using a mix of binary search and data str…
Bitwise XOR of All Pairings
Compute the overall bitwise XOR from all pairings between two arrays using efficient array and bit manipulation techniqu…
Maximum Sum of an Hourglass
Calculate the maximum sum of an hourglass in a 2D matrix using array traversal and submatrix evaluation techniques effic…
Minimize XOR
Minimize XOR problem asks for an integer that minimizes XOR with another, applying greedy choices for bit manipulation.
Find The Original Array of Prefix Xor
Find the original array from a given prefix XOR array using bitwise manipulation techniques.
Using a Robot to Print the Lexicographically Smallest String
Solve the problem of using a robot to print the lexicographically smallest string with stack-based state management.
Range Product Queries of Powers
The Range Product Queries of Powers problem requires calculating the product of powers of 2 for a range of queries on a …
Minimize Maximum of Array
Minimize Maximum of Array involves finding the smallest possible maximum value after applying a series of operations on …
Count Number of Distinct Integers After Reverse Operations
This problem requires counting distinct integers after performing reverse operations on each integer in an array.
Sum of Number and Its Reverse
Determine if a non-negative integer can be expressed as the sum of a number and its reverse using enumeration and math r…
Number of Subarrays With GCD Equal to K
Count the number of subarrays with GCD equal to a given value k from a list of integers.
Words Within Two Edits of Dictionary
Identify all words in queries that can match dictionary entries with at most two character changes efficiently using arr…
Destroy Sequential Targets
Find the minimum seed value to destroy the most targets on a number line, using array scanning and hash lookup.
Most Popular Video Creator
Identify the most popular video creator by summing views and selecting their top-viewed video with array and hash patter…
Minimum Addition to Make Integer Beautiful
Find the minimum addition to a number such that its digits sum to a value less than or equal to a given target.
Maximum Sum of Distinct Subarrays With Length K
Find the maximum sum of all distinct-element subarrays of length k using array scanning and hash lookup techniques.
Total Cost to Hire K Workers
Optimize the total cost of hiring exactly k workers using a two-pointer approach with invariant tracking and priority qu…
Count Ways To Build Good Strings
Count the number of ways to build good binary strings using dynamic programming with state transitions.
Most Profitable Path in a Tree
Solve the 'Most Profitable Path in a Tree' problem using graph traversal and depth-first search techniques to maximize A…
Number of Subarrays With LCM Equal to K
Find the number of subarrays in an array where the least common multiple (LCM) of the subarray equals a given integer k.
Minimum Number of Operations to Sort a Binary Tree by Level
Determine the minimum number of swaps to sort each level of a binary tree using level-wise traversal efficiently.
Closest Nodes Queries in a Binary Search Tree
Solve the problem of finding closest nodes in a Binary Search Tree for multiple queries, efficiently handling each query…
Minimum Fuel Cost to Report to the Capital
Calculate the minimum fuel needed for all city representatives to reach the capital using DFS on a tree graph efficientl…
Difference Between Ones and Zeros in Row and Column
This problem requires computing a difference matrix based on the ones and zeros in each row and column of a binary matri…
Minimum Penalty for a Shop
Determine the earliest closing hour of a shop to minimize penalty using a string of customer visits and prefix sums.
Append Characters to String to Make Subsequence
Determine the minimum characters to append to s so t becomes a subsequence using efficient two-pointer scanning techniqu…
Remove Nodes From Linked List
This problem requires removing nodes from a linked list when a larger node exists to their right, testing pointer manipu…
Divide Players Into Teams of Equal Skill
Divide players into equal skill teams and return the sum of their chemistry, or -1 if impossible.
Minimum Score of a Path Between Two Cities
Find the minimum distance in a path connecting two cities using graph traversal strategies efficiently.
Maximum Star Sum of a Graph
Find the maximum star sum in a graph with specific node values and edges, using greedy algorithms to select the optimal …
Frog Jump II
Frog Jump II requires finding the minimal maximum jump length for a frog to traverse stones forward and backward efficie…
Longest Square Streak in an Array
Find the length of the longest subsequence where each element is a perfect square of its previous one.
Design Memory Allocator
Design a memory allocator that simulates allocation and deallocation of memory blocks.
Smallest Value After Replacing With Sum of Prime Factors
Replace a number with the sum of its prime factors until it stabilizes, and return the smallest value.
Reward Top K Students
Calculate top K student scores by scanning reports and using hash tables for positive and negative word lookups efficien…
Minimize the Maximum of Two Arrays
Minimize the Maximum of Two Arrays requires finding the smallest possible maximum number across two arrays, using binary…
Take K of Each Character From Left and Right
Find the minimum number of minutes needed to take at least k of each character from both ends of a string.
Maximum Tastiness of Candy Basket
Maximize the tastiness of a candy basket by choosing k candies from a list of candy prices.
Distinct Prime Factors of Product of Array
Find the number of distinct prime factors in the product of an array of integers.
Partition String Into Substrings With Values at Most K
Determine the minimum number of substrings from a numeric string such that each substring value does not exceed k using …
Closest Prime Numbers in Range
Find the two closest prime numbers within a given range using efficient number theory techniques and gap comparisons.
Find Consecutive Integers from a Data Stream
Design a data stream checker to identify consecutive integers from a stream, focusing on handling state transitions effi…
Find Xor-Beauty of Array
Find the xor-beauty of an array by XORing the effective values of all possible triplets of indices.
Maximal Score After Applying K Operations
Maximize your score by applying exactly k operations on an array using greedy selection and heap optimization techniques…
Make Number of Distinct Characters Equal
Determine if a single swap can equalize distinct character counts between two strings using hash tables for tracking fre…
Increment Submatrices by One
Increment Submatrices by One focuses on efficiently updating submatrices using row-wise prefix sums in an n by n matrix.
Count the Number of Good Subarrays
Count the number of subarrays that contain at least k pairs of equal elements using array scanning and hash lookup.
Minimum Operations to Make Array Equal II
Calculate the minimum operations to make two integer arrays equal using greedy adjustments with modular checks efficient…
Maximum Subsequence Score
Maximize the score of a subsequence by selecting indices based on nums1 and nums2, using a greedy approach and sorting.
Sort the Students by Their Kth Score
Sort a matrix of student scores by the kth exam efficiently using array manipulation and custom sorting techniques.
Apply Bitwise Operations to Make Strings Equal
Determine if a binary string s can be transformed into target using repeated bitwise operations on paired indices effici…
Count Collisions of Monkeys on a Polygon
Calculate the total number of monkey collisions on a convex polygon using math and recursion efficiently for large n.
Maximum Number of Integers to Choose From a Range I
Determine the maximum count of integers from 1 to n avoiding banned numbers while keeping the sum under maxSum.
Maximize Win From Two Segments
Maximize the total prizes by choosing two segments of length k on a sorted line of prize positions efficiently using bin…
Disconnect Path in a Binary Matrix by at Most One Flip
Determine if a single cell flip can disconnect a path from the top-left to bottom-right in a binary matrix efficiently u…
Count Vowel Strings in Ranges
Count the number of strings that start and end with a vowel in given ranges within an array of words.
House Robber IV
House Robber IV requires calculating minimum maximum money the robber can take using state transition dynamic programmin…
Count the Number of Fair Pairs
Efficiently count all fair pairs in an array using sorting and binary search, focusing on the sum range between lower an…
Substring XOR Queries
Solve the Substring XOR Queries problem using array scanning and hash lookup to efficiently handle multiple queries on b…
Minimum Score by Changing Two Elements
The problem asks for the minimum score after changing two elements of an array using a greedy approach.
Minimum Impossible OR
Find the smallest positive integer that cannot be formed from any subsequence OR combination in the array.
Minimum Operations to Reduce an Integer to 0
Compute the minimum number of operations to reduce a positive integer to zero using additions or subtractions of powers …
Count the Number of Square-Free Subsets
Learn how to efficiently count square-free subsets using state transition dynamic programming with bitmask optimizations…
Find the Divisibility Array of a String
Calculate the divisibility array for a string by checking if prefixes are divisible by a given number.
Find the Maximum Number of Marked Indices
Maximize marked indices in an array by performing allowed operations, applying binary search to find the optimal count e…
Count Total Number of Colored Cells
The "Count Total Number of Colored Cells" problem requires deriving a formula to compute colored cells based on elapsed …
Count Ways to Group Overlapping Ranges
Count Ways to Group Overlapping Ranges is a medium difficulty problem focused on array manipulation and sorting to count…
Kth Largest Sum in a Binary Tree
Find the kth largest level sum in a binary tree using level-order traversal and sorting.
Rearrange Array to Maximize Prefix Score
Maximize the number of positive prefix sums by rearranging an integer array using a greedy, order-focused strategy.
Count the Number of Beautiful Subarrays
Count the Number of Beautiful Subarrays is a Medium-level problem involving array scanning and hash table lookup to find…
Maximize Greatness of an Array
Maximize Greatness of an Array requires permuting numbers to exceed original values at most indices efficiently.
Find Score of an Array After Marking All Elements
The problem involves marking elements in an array and calculating the score based on adjacent elements.
Minimum Time to Repair Cars
Find the minimum time to repair all cars using mechanics with different ranks, applying binary search over possible time…
Check Knight Tour Configuration
Validate a knight's movement configuration on an n x n chessboard to check if it forms a valid Knight's Tour.
The Number of Beautiful Subsets
Count all non-empty subsets of an array where no two numbers have an absolute difference equal to k, using array scannin…
Smallest Missing Non-negative Integer After Operations
Find the smallest missing non-negative integer after repeated additions or subtractions of a given value in nums array e…
Prime Subtraction Operation
Determine if it's possible to make the array strictly increasing using prime subtractions.
Minimum Operations to Make All Array Elements Equal
Find the minimum number of operations to make all elements in an array equal for each query.
Find the Substring With Maximum Cost
Find the Substring With Maximum Cost requires calculating substring values using a hash lookup for character costs, with…
Make K-Subarray Sums Equal
Solve Make K-Subarray Sums Equal by grouping circular indices with gcd cycles and minimizing each group to its median.
Convert an Array Into a 2D Array With Conditions
Learn how to convert an integer array into a 2D array with distinct rows using array scanning plus hash lookup efficient…
Mice and Cheese
In 'Mice and Cheese', you must maximize the total reward of two mice eating cheese while respecting their preferences an…
Sum of Distances
In this problem, you calculate an array where each element is the sum of absolute differences of indices for equal value…
Minimize the Maximum Difference of Pairs
Minimize the Maximum Difference of Pairs seeks to optimize the maximum pairwise difference in a set of index pairs from …
Check if Object Instance of Class
Implement a function to check if an object is an instance of a specific class or its superclass in JavaScript.
Cache With Time Limit
Implement a time-limited cache where keys expire after a given duration, with operations to set, get, and count active k…
Memoize
This problem focuses on creating a memoized function that caches results to prevent repeated computation with identical …
Snail Traversal
Transform a 1D array into a 2D matrix following the snail traversal core interview pattern efficiently and safely.
Flatten Deeply Nested Array
Flatten Deeply Nested Array involves transforming multi-dimensional arrays based on depth constraints, requiring a caref…
Debounce
Create a debounced function that delays execution and cancels previous calls within a time window.
Group By
Implementing the Group By core interview pattern efficiently sorts array elements into keyed groups based on a selector …
Promise Time Limit
Implement a time-limited wrapper for any asynchronous function to enforce execution constraints and prevent overruns.
Find the Score of All Prefixes of an Array
Compute the score of each prefix in an array using conversion rules while tracking the maximum efficiently for prefix su…
Cousins in Binary Tree II
Replace each node in a binary tree with the sum of all its cousins by carefully tracking depth and parent relationships.
Minimum Additions to Make Valid String
Determine the minimum insertions required to transform a given string into repeated concatenations of 'abc' using dynami…
Nested Array Generator
Implement a generator that performs inorder traversal on a multi-dimensional array of integers.
Sliding Subarray Beauty
Compute the xth smallest negative number in each sliding subarray using array scanning and hash frequency tracking effic…
Minimum Number of Operations to Make All Array Elements Equal to 1
Find the minimum number of operations to transform every element of a positive integer array into 1 using gcd operations…
Find the Prefix Common Array of Two Arrays
This problem challenges you to find the prefix common array of two integer permutations, utilizing array scanning and ha…
Maximum Number of Fish in a Grid
Maximize the number of fish that can be caught by performing DFS on an optimal starting point in a grid.
First Completely Painted Row or Column
Find the first index where a row or column is completely painted in a matrix based on an array of integers.
Minimum Cost of a Path With Special Roads
Find the minimum cost path between two points, using special roads or direct moves in a 2D space.
Frequency Tracker
Design a data structure to track values and answer frequency-related queries efficiently using hash tables.
Number of Adjacent Elements With the Same Color
Calculate the number of adjacent elements sharing the same color after sequentially updating an initially zeroed array u…
Make Costs of Paths Equal in a Binary Tree
Minimize the cost increments required to equalize path costs in a binary tree from root to leaves.
Sum in a Matrix
Calculate the maximum score by repeatedly removing the largest elements from each row of a 2D matrix efficiently using s…
Maximum OR
Maximize the bitwise OR of an array by applying at most k multiplication operations on selected elements.
Neighboring Bitwise XOR
Determine if a binary array original exists that produces the given derived array using neighboring bitwise XOR logic.
Maximum Number of Moves in a Grid
Maximize the number of moves in a grid starting from the first column using state transition dynamic programming.
Count the Number of Complete Components
Determine the number of complete connected components in an undirected graph using efficient traversal techniques and gr…
Call Function with Custom Context
Learn to implement a callPolyfill method that correctly sets a function's this context and passes arguments properly.
Event Emitter
Design an EventEmitter class that can subscribe, emit, and unsubscribe events, mimicking patterns seen in Node.js or DOM…
Find the Punishment Number of an Integer
Find the punishment number of a given integer using backtracking search with pruning.
Compact Object
Compact Object requires removing all falsy values from an object or array recursively to produce a clean, minimal struct…
Extra Characters in a String
The problem asks for the minimum number of extra characters left after optimally breaking a string into substrings found…
Maximum Strength of a Group
Maximize the strength of a student group by carefully selecting students based on their scores, using dynamic programmin…
Difference of Number of Distinct Values on Diagonals
Find the difference in the number of distinct diagonal values in a matrix, returning results in a new matrix.
Minimum Cost to Make All Characters Equal
Find the minimum cost to make all characters of a binary string equal by performing two types of operations.
Sum of Matrix After Queries
Calculate the total sum of a zero-filled n x n matrix after sequentially applying row and column update queries efficien…
Execute Asynchronous Functions in Parallel
Solve the problem of executing asynchronous functions in parallel, handling resolve and reject scenarios effectively.
Join Two Arrays by ID
Merge two arrays of objects by their id keys, resolving conflicts with arr2 values and sorting by id ascending.
Find the Longest Semi-Repetitive Substring
Find the length of the longest substring where at most one adjacent pair of digits repeats, using a sliding window appro…
Movement of Robots
Calculate total distances between robots moving on a number line while accounting for collisions using array plus braint…
Lexicographically Smallest String After Substring Operation
Given a string, perform operations to make it lexicographically smaller using a greedy approach with substring modificat…
Collecting Chocolates
Calculate the minimum cost to collect all chocolate types using rotations and purchases in an array-based enumeration pa…
Find the Value of the Partition
Find the minimum partition value by dividing a positive integer array into two subarrays using sorting for efficiency.
Special Permutations
Count the number of special permutations for a given array using dynamic programming and bit manipulation.
Construct the Longest New String
Maximize the length of a string built from AA, BB, and AB without creating triple repeats using DP and greedy logic.
Decremental String Concatenation
Solve the Decremental String Concatenation problem by applying dynamic programming to minimize string length after conca…
Count Zero Request Servers
Count Zero Request Servers finds the number of servers with zero requests during specific time intervals for a given set…
Minimum Operations to Make the Integer Zero
This problem challenges you to compute the minimum operations to reduce an integer to zero using bit manipulation and st…
Ways to Split Array Into Good Subarrays
Calculate the number of ways to partition a binary array into good subarrays using state transition dynamic programming …
Prime Pairs With Target Sum
Find all prime number pairs that sum up to a given integer n using an efficient sieve-based array approach.
Continuous Subarrays
Count all continuous subarrays efficiently using sliding window with running max-min state tracking for array consistenc…
Relocate Marbles
Relocate marbles to new positions in an array by simulating moves, and return sorted occupied positions.
Partition String Into Minimum Beautiful Substrings
Partition a binary string into the fewest beautiful substrings using state transition dynamic programming and careful su…
Number of Black Blocks
Calculate the number of black blocks in a grid given a list of black cell coordinates.
Maximum Number of Jumps to Reach the Last Index
Find the maximum number of jumps to reach the last index using state transition dynamic programming efficiently in array…
Longest Non-decreasing Subarray From Two Arrays
Maximize the length of a non-decreasing subarray by optimally choosing elements from two arrays using dynamic programmin…
Apply Operations to Make All Array Elements Equal to Zero
Determine if all elements in a given array can be reduced to zero using repeated k-length prefix operations efficiently.
Maximum Beauty of an Array After Applying Operation
Find the maximum beauty of an array by adjusting elements within a range using binary search and sliding window techniqu…
Minimum Index of a Valid Split
Find the minimum index to split an array such that both subarrays have the same dominant element.
Sort Vowels in a String
Sort Vowels in a String requires identifying vowels in a string and rearranging them in ascending order while keeping co…
Visit Array Positions to Maximize Score
Maximize your score by visiting positions in an array while handling penalties for parity changes efficiently with DP.
Ways to Express an Integer as Sum of Powers
Compute the number of ways to express an integer as a sum of unique powers using state transition dynamic programming ef…
Largest Element in an Array after Merge Operations
This problem focuses on applying greedy choices and merging elements to find the largest element in an array.
Count Complete Subarrays in an Array
Count Complete Subarrays in an Array requires scanning the array while tracking elements to detect subarrays with all di…
Shortest String That Contains Three Strings
Find the shortest string containing three given strings using a greedy approach while ensuring it is lexicographically s…
Insert Greatest Common Divisors in Linked List
The problem involves inserting greatest common divisors between adjacent nodes in a linked list.
Minimum Seconds to Equalize a Circular Array
Find the minimum number of seconds to equalize a circular array using array scanning and hash lookup techniques.
Check if it is Possible to Split Array
Determine whether an array can be fully split into single-element subarrays using a state transition dynamic programming…
Find the Safest Path in a Grid
Find the Safest Path in a Grid uses binary search and BFS to maximize path safeness from thieves in a grid.
Double a Number Represented as a Linked List
Double a number represented as a linked list by carefully managing node values and carries with pointer traversal techni…
Minimum Absolute Difference Between Elements With Constraint
Find the minimum absolute difference between two array elements that are at least x indices apart using binary search.
Make String a Subsequence Using Cyclic Increments
Determine if str2 can be made a subsequence of str1 by incrementing characters cyclically using at most one operation.
Sorting Three Groups
Determine the minimum removals to make an array of 1s, 2s, and 3s non-decreasing using dynamic programming transitions.
Determine the Minimum Sum of a k-avoiding Array
Determine the minimum sum of a k-avoiding array by choosing distinct integers such that no pair sums to a given k.
Maximize the Profit as the Salesman
Determine the maximum profit a salesman can earn by strategically selecting non-overlapping offers on consecutive houses…
Find the Longest Equal Subarray
Find the maximum length of an equal subarray after removing up to k elements using array scanning and hash-based index t…
Find the Minimum Possible Sum of a Beautiful Array
Find the minimum possible sum of a beautiful array that satisfies the given conditions with the greedy approach.
Check if Strings Can be Made Equal With Operations II
Check if two strings can be made equal using operations that swap characters with the same parity.
Maximum Sum of Almost Unique Subarray
Find the maximum sum of subarrays that contain at least m distinct elements using array scanning and hash lookups effici…
Minimum Operations to Make a Special Number
Minimize operations to make a number divisible by 25 by deleting digits. Use greedy choice and invariant validation.
Count of Interesting Subarrays
Count all subarrays where the number of elements satisfying a modulo condition equals a target k using efficient prefix …
Determine if a Cell Is Reachable at a Given Time
The problem asks if a target cell can be reached from a starting position within a given time on a 2D grid.
Minimum Moves to Spread Stones Over Grid
Solve the problem of distributing 9 stones across a 3x3 grid with minimal moves using state transition dynamic programmi…
Minimum Array Length After Pair Removals
This problem involves minimizing the length of a sorted array by repeatedly removing adjacent pairs of equal elements.
Count Pairs of Points With Distance k
Solve the problem of counting pairs of points with distance k using array scanning and hash table techniques.
Happy Students
The Happy Students problem asks how many ways a teacher can select a group of students so everyone is happy, based on ce…
Maximum Number of Alloys
Determine the maximum number of alloys possible using limited metal stock and budget, leveraging binary search efficient…
Beautiful Towers I
Solve Beautiful Towers I by testing each peak and enforcing mountain limits with monotonic stack style height propagatio…
Beautiful Towers II
Maximize tower configurations with the stack-based approach while ensuring mountain-like patterns in this medium difficu…
Minimum Number of Operations to Make Array Empty
Minimize the number of operations to make an array empty by leveraging array scanning and hash lookup.
Split Array Into Maximum Number of Subarrays
Maximize the number of subarrays in an array while ensuring each subarray's bitwise AND meets the minimum score requirem…
Maximum Value of an Ordered Triplet II
Solve Maximum Value of an Ordered Triplet II in linear time by tracking the best left difference and right multiplier.
Minimum Size Subarray in Infinite Array
Find the shortest subarray in an infinite array that sums to a given target using array scanning and hash lookup.
Minimum Processing Time
Determine the minimum total processing time by optimally assigning tasks to multiple processors using a greedy approach.
Apply Operations to Make Two Strings Equal
Apply Operations to Make Two Strings Equal involves transforming binary strings with a cost-based dynamic programming ap…
Longest Unequal Adjacent Groups Subsequence II
Find the longest subsequence of indices such that the corresponding strings have a valid Hamming distance and group cons…
Shortest and Lexicographically Smallest Beautiful String
Find the shortest beautiful substring in a binary string and return the lexicographically smallest option efficiently us…
Find Indices With Index and Value Difference II
Locate two indices in an array where both index and value differences meet specified thresholds using precise scanning t…
Construct Product Matrix
Solve the "Construct Product Matrix" problem by calculating the product of elements in 2D matrices without division.
Minimum Sum of Mountain Triplets II
Find the minimum sum of a valid mountain triplet in an integer array, or return -1 if no valid triplet exists.
Minimum Number of Groups to Create a Valid Assignment
The problem involves sorting balls into boxes while minimizing the number of boxes, adhering to size constraints.
Minimum Number of Changes to Make Binary String Beautiful
This problem involves determining the minimum number of changes to make a binary string beautiful using string-driven st…
Length of the Longest Subsequence That Sums to Target
Find the length of the longest subsequence in an array that sums to a target value, using dynamic programming.
Minimum Equal Sum of Two Arrays After Replacing Zeros
Find the minimum sum where two arrays become equal after replacing all zeros with positive integers using a greedy strat…
Minimum Increment Operations to Make Array Beautiful
Optimize the number of increment operations to make an array beautiful by ensuring subarrays of size 3 or more meet the …
Find Champion II
Identify the strongest team in a tournament DAG using graph-driven logic, ensuring correct handling of in-degree zero ch…
Maximum Score After Applying Operations on a Tree
Solve Maximum Score After Applying Operations on a Tree by turning healthy-path constraints into subtree DP and forced-v…
Distribute Candies Among Children II
Determine how to distribute n candies among 3 children without exceeding a limit on individual candies.
Number of Strings Which Can Be Rearranged to Contain Substring
Calculate how many strings of length n can be rearranged to contain "leet" using dynamic programming and combinatorics.
High-Access Employees
Identify employees with high system access within one-hour periods based on access logs.
Minimum Operations to Maximize Last Elements in Arrays
Minimize the number of operations needed to maximize the last elements of two arrays with specific swaps.
Separate Black and White Balls
Solve the "Separate Black and White Balls" problem by swapping adjacent balls to group all black balls to the right with…
Maximum Xor Product
Find the maximum value of (a XOR x) * (b XOR x) using greedy bitwise choices and invariant validation.
Maximize Area of Square Hole in Grid
Learn how to maximize the area of a square-shaped hole by selectively removing horizontal and vertical bars efficiently …
Minimum Number of Coins for Fruits
Calculate the minimum coins to buy fruits using state transition dynamic programming while handling rewards and purchase…
Count Beautiful Substrings I
Given a string and a value k, count the number of beautiful substrings where vowels * consonants % k == 0.
Make Lexicographically Smallest Array by Swapping Elements
Solve the problem of making an array lexicographically smallest through element swaps under a limit constraint.
Minimum Number of Coins to be Added
Determine the minimum number of coins to add so all values up to target are obtainable using a greedy sum approach.
Remove Adjacent Almost-Equal Characters
Minimize operations to remove adjacent almost-equal characters using dynamic programming and greedy methods.
Length of Longest Subarray With at Most K Frequency
Find the maximum length subarray where each number appears at most k times using array scanning and hash lookups.
Double Modular Exponentiation
Solve the Double Modular Exponentiation problem by applying array manipulation and modular arithmetic to find good indic…
Count Subarrays Where Max Element Appears at Least K Times
Find the number of subarrays where the maximum element appears at least k times using a sliding window approach.
Divide Array Into Arrays With Max Difference
Divide an array into subarrays with a maximum element difference under a given threshold using a greedy approach.
Minimum Cost to Make Array Equalindromic
Determine the minimum cost to convert an integer array into a palindromic array using allowed element modifications effi…
Find Polygon With the Largest Perimeter
Determine the largest perimeter polygon from a set of side lengths using a greedy approach with invariant validation che…
Maximum Square Area by Removing Fences From a Field
This problem challenges you to calculate the largest square area possible by removing fences from a given rectangular fi…
Minimum Cost to Convert String I
This problem asks to calculate the minimum cost to convert a string from source to target using specific character trans…
Find Longest Special Substring That Occurs Thrice I
Find the longest special substring in a string that appears at least three times, or return -1 if no such substring exis…
Find Longest Special Substring That Occurs Thrice II
Find the longest special substring that occurs at least three times in a given string using binary search and hash table…
Minimum Number of Operations to Make Array XOR Equal to K
Find the minimum number of operations to make the XOR of an array equal to a given value k by modifying array elements.
Minimum Number of Operations to Make X and Y Equal
Determine the minimum operations to make two integers equal using increment, decrement, and division efficiently with DP…
Minimum Moves to Capture The Queen
Determine the fewest moves to capture the black queen using only white pieces with careful position analysis.
Maximum Size of a Set After Removals
Maximize a set size by strategically removing half of elements from two arrays using hash lookups and array scanning.
Find Beautiful Indices in the Given Array I
Identify all beautiful indices where substring a appears and a nearby substring b exists within distance k efficiently.
Maximum Number That Sum of the Prices Is Less Than or Equal to K
Find the greatest number whose accumulated price, based on binary set bit positions, is less than or equal to k.
Find if Array Can Be Sorted
Determine if a given array can be sorted using adjacent swaps restricted by equal set bits in binary representation.
Minimize Length of Array Using Operations
Minimize the length of an integer array through a series of operations, using a greedy approach with modular arithmetic.
Count the Number of Houses at a Certain Distance I
Determine the number of house pairs at each street distance using graph traversal and breadth-first search efficiently.
Minimum Number of Pushes to Type Word II
Given a word, find the minimum number of pushes to type it on a remapped keypad using a greedy approach.
Find the Maximum Number of Elements in Subset
This problem asks you to find the maximum subset size where each number in the subset follows a specific pattern with ha…
Alice and Bob Playing Flower Game
Alice and Bob play a turn-based game on a circular field with flowers, where players must choose pairs that satisfy pari…
Find the Number of Ways to Place People I
Calculate how many valid pairs of points can be formed on a 2D plane using array and math enumeration techniques efficie…
Maximum Good Subarray Sum
Find the maximum sum of any subarray where the first and last elements differ by exactly k using efficient array scannin…
Minimum Time to Revert Word to Initial State I
Determine the minimum seconds to revert a string to its original state using repeated prefix shifts of length k efficien…
Find the Grid of Region Average
Find the Grid of Region Average requires identifying regions in a matrix where pixel differences are below a threshold, …
Number of Subarrays That Match a Pattern I
Count all subarrays in a given integer array that strictly follow a defined numeric pattern using rolling hash checks ef…
Maximum Palindromes After Operations
The problem focuses on maximizing the number of palindromes that can be formed from a given list of words through specif…
Apply Operations to Make String Empty
Learn how to systematically apply operations on a string using array scanning and hash lookups to reduce it efficiently.
Maximum Number of Operations With the Same Score II
This problem asks to maximize operations on an integer array where all deletions produce the same score using dynamic pr…
Find the Length of the Longest Common Prefix
Determine the length of the longest common prefix between two integer arrays using array scanning and hash lookup effici…
Most Frequent Prime
Find the most frequent prime over 10 from numbers generated by scanning a 2D matrix in all straight directions efficient…
Find the Largest Area of Square Inside Two Rectangles
Find the largest square area that can fit inside the intersection of two or more rectangles in a 2D plane.
Earliest Second to Mark Indices I
The problem asks to determine the earliest second to mark all indices in an array using a set of operations.
Minimum Operations to Exceed Threshold Value II
Calculate the fewest operations to make every array element exceed a threshold using a min-heap simulation strategy effi…
Count Pairs of Connectable Servers in a Weighted Tree Network
This problem involves counting pairs of connectable servers in a weighted tree network using binary-tree traversal and D…
Count Submatrices with Top-Left Element and Sum Less Than k
Count all submatrices including the top-left element with sum less than k using array and matrix prefix sum strategies.
Minimum Operations to Write the Letter Y on a Grid
Find the minimum number of operations to write the letter Y on a grid by altering cell values.
Maximize Happiness of Selected Children
Maximize the happiness of selected children by choosing the k happiest ones and applying greedy strategies to minimize l…
Shortest Uncommon Substring in an Array
Find the shortest substring for each string in an array that does not appear in any other string efficiently using hashi…
Mark Elements on Array by Performing Queries
Efficiently mark elements in an array based on queries using scanning plus hash lookup to track marked indices and compu…
Replace Question Marks in String to Minimize Its Value
Minimize the cost of a string with '?' characters by replacing them with letters in lexicographical order while minimizi…
Count Substrings Starting and Ending with Given Character
Given a string and a character, find the total number of substrings that start and end with that character.
Minimum Deletions to Make String K-Special
Minimize deletions to make a string k-special by adjusting character frequencies.
Apply Operations to Make Sum of Array Greater Than or Equal to k
Given an array nums, find the minimum number of operations to make the sum of elements greater than or equal to k.
Most Frequent IDs
Track the most frequent ID after each update in a dynamic collection of IDs with changing frequencies.
Minimum Levels to Gain More Points
Determine the minimum number of levels Alice must play in a binary game array to secure more points than Bob using prefi…
Shortest Subarray With OR at Least K II
Find the length of the shortest subarray where the bitwise OR of all its elements is at least a given value.
Water Bottles II
Compute the maximum number of water bottles you can drink by simulating exchanges with step-by-step math logic.
Count Alternating Subarrays
Count all alternating subarrays in a binary array efficiently using array patterns and simple mathematical reasoning.
Lexicographically Smallest String After Operations With Constraint
Minimize a string lexicographically using a series of operations constrained by a given integer k.
Minimum Operations to Make Median of Array Equal to K
The problem involves minimizing operations to make the median of an array equal to a given value k using a greedy approa…
Minimum Rectangles to Cover Points
Find the minimum number of rectangles needed to cover all points, given constraints on width and position.
Minimum Time to Visit Disappearing Nodes
Determine the minimum time to visit each node in a disappearing-node graph using arrays, graphs, and priority queues eff…
Maximum Prime Difference
Calculate the largest index gap between prime numbers in an array using array traversal and number theory insights effic…
Count the Number of Special Characters II
Count the Number of Special Characters II is a medium difficulty string and hash table problem that involves identifying…
Minimum Number of Operations to Satisfy Conditions
This problem asks to find the minimum number of operations on a 2D grid using state transition dynamic programming effic…
Right Triangles
Count all possible right triangles in a 2D boolean grid using array scanning and hash lookup for efficiency.
Find All Possible Stable Binary Arrays I
Find all stable binary arrays of a given number of 0's, 1's, and limit using dynamic programming and state transitions.
Find the Integer Added to Array II
Given two arrays nums1 and nums2, determine the integer added to nums1 to make it equal to nums2 after removing two elem…
Minimum Array End
Construct an array where elements are greater than the previous one, and the bitwise AND of all elements equals a given …
Minimum Number of Operations to Make Word K-Periodic
The problem requires calculating the minimum number of operations to make a string k-periodic using specific substring r…
Minimum Length of Anagram Concatenation
The problem asks to find the minimum length of a string t such that s is a concatenation of anagrams of t.
Maximum Points Inside the Square
Find the maximum number of points inside a valid square centered at the origin using a scanning and hashing approach.
Minimum Substring Partition of Equal Character Frequency
Partition a string into substrings with equal character frequencies using dynamic programming and state transitions.
Taking Maximum Energy From the Mystic Dungeon
Maximize your energy by strategically jumping through magicians using array and prefix sum techniques for optimal path c…
Maximum Difference Score in a Grid
Maximize the score in a grid by making moves to the bottom or right, using state transition dynamic programming.
Special Array II
Determine whether each subarray meets the special condition of alternating parity for all adjacent elements efficiently …
Sum of Digit Differences of All Pairs
Sum of Digit Differences of All Pairs is a problem that involves counting digit differences in pairs from an array of in…
Find Occurrences of an Element in an Array
Determine the position of each requested occurrence of x in nums using a hash table and efficient array scanning.
Find the Number of Distinct Colors Among the Balls
Efficiently track colors on balls using array scanning and hash lookup to return the count of distinct colors after each…
String Compression III
Compress a string by repeatedly taking maximal same-character prefixes, following a string-driven solution strategy effi…
Find the Number of Good Pairs II
Calculate total good pairs by scanning two arrays and using hash lookup to match divisible elements efficiently with k.
Count Days Without Meetings
Count Days Without Meetings is a problem where you need to count days without scheduled meetings in a given work period.
Lexicographically Minimum String After Removing Stars
Find the lexicographically smallest string by removing stars using stack-based state management and careful character se…
Find The First Player to win K Games in a Row
Determine which player first wins k consecutive games using array simulation logic to track ongoing victories efficientl…
Find the Maximum Length of a Good Subsequence I
Find the maximum length of a good subsequence by scanning arrays and using hash lookups for value remapping efficiently.
Find the N-th Value After K Seconds
Solve for the N-th value after K seconds by simulating array updates and using prefix sum techniques.
Maximum Total Reward Using Operations I
Optimize the total reward by choosing operations on array indices using state transition dynamic programming techniques …
Count Pairs That Form a Complete Day II
Count the number of valid pairs of hours that form a complete day by checking if their sum is a multiple of 24.
Maximum Total Damage With Spell Casting
Calculate the maximum total damage by selectively casting spells while avoiding adjacent power conflicts using array sca…
Minimum Operations to Make Binary Array Elements Equal to One I
Find the minimum number of operations to make all elements of a binary array equal to one using sliding window and state…
Minimum Operations to Make Binary Array Elements Equal to One II
Solve the Minimum Operations to Make Binary Array Elements Equal to One II using state transition dynamic programming ef…
Find the Minimum Area to Cover All Ones I
Find the smallest rectangle to cover all 1's in a 2D binary matrix, focusing on array and matrix handling.
Maximize Total Cost of Alternating Subarrays
Maximize the total cost of alternating subarrays using dynamic programming to efficiently split an array into optimal su…
Find the Maximum Length of Valid Subsequence I
Find the longest valid subsequence in an array of integers using dynamic programming to handle different patterns of seq…
Find the Maximum Length of Valid Subsequence II
Determine the maximum length of a valid subsequence using state transition dynamic programming with careful modulo const…
Maximum Points After Enemy Battles
Solve the "Maximum Points After Enemy Battles" problem by maximizing points through greedy choices with energy validatio…
Alternating Groups II
Solve the problem of counting alternating groups in a circle of tiles using a sliding window approach.
Generate Binary Strings Without Adjacent Zeros
Generate all binary strings of length n without adjacent zeros using backtracking search with pruning for efficient enum…
Count Submatrices With Equal Frequency of X and Y
Count the number of submatrices with equal frequency of 'X' and 'Y' in a 2D character grid.
Delete Nodes From Linked List Present in Array
Remove nodes from a linked list if their values exist in a given array.
Minimum Cost for Cutting Cake I
In this problem, you need to minimize the cost of cutting a cake into 1x1 pieces using vertical and horizontal cuts.
Minimum Length of String After Operations
Find the minimum length of a string after performing operations based on character frequency.
Minimum Array Changes to Make Differences Equal
Minimize changes to make array differences equal by replacing elements within a given range.
Vowels Game in a String
Solve the Vowels Game in a String using optimal moves and string analysis to predict the winner efficiently and accurate…
Maximum Number of Operations to Move Ones to the End
This problem requires finding the maximum number of operations to move ones to the end of a binary string.
Find the Count of Numbers Which Are Not Special
Count the numbers between two integers that are not special, where special numbers are squares of primes.
Count the Number of Substrings With Dominant Ones
Count the number of substrings in a binary string with dominant ones, using a sliding window approach with state updates…
Minimum Number of Flips to Make Binary Grid Palindromic I
Find the minimum flips to make a binary grid palindromic by scanning with two pointers and tracking symmetry efficiently…
Minimum Number of Flips to Make Binary Grid Palindromic II
The problem asks to flip cells in a binary grid to make its rows and columns palindromic using the minimum number of fli…
Shortest Distance After Road Addition Queries I
Solve shortest paths dynamically in a growing graph using BFS, updating distances efficiently after each road addition q…
Count the Number of Good Nodes
Determine how many nodes in a binary tree have all child subtrees of equal size using DFS traversal efficiently.
Find the Power of K-Size Subarrays I
Given an array, find the power of all subarrays of size k using a sliding window approach.
Find the Power of K-Size Subarrays II
Compute the power of all k-size subarrays in an array using sliding window with running state updates efficiently.
Maximum Energy Boost From Two Drinks
Maximize energy boost from two drinks with a state transition dynamic programming approach.
Count Almost Equal Pairs I
Count Almost Equal Pairs I involves finding pairs of elements that can be made equal by swapping at most one digit.
Hash Divided String
Hash Divided String requires splitting a string into equal parts and combining character values modulo 26 to form a new …
K-th Nearest Obstacle Queries
Solve the K-th nearest obstacle query problem using array and heap (priority queue) techniques to find distances efficie…
Maximize Score of Numbers in Ranges
Maximize Score of Numbers in Ranges asks to find the maximum score by selecting integers within given intervals with a f…
Reach End of Array With Max Score
Calculate the maximum score to reach the end of an array using greedy jumps based on array values and distances.
Find a Safe Walk Through a Grid
Determine if you can safely traverse a binary grid from top-left to bottom-right using limited health points.
Maximum Multiplication Score
The problem requires selecting four indices from an array to maximize a dynamic score with a transition approach.
Minimum Number of Valid Strings to Form Target I
Use dynamic programming to split target into the fewest prefixes that match any word prefix, while ruling out dead posit…
Report Spam Message
Determine if a message contains at least two banned words using array scanning and hash lookup.
Minimum Number of Seconds to Make Mountain Height Zero
Determine the minimum seconds required to reduce a mountain to zero height using simultaneous workers efficiently.
Count Substrings That Can Be Rearranged to Contain a String I
Count the number of valid substrings in word1 that can be rearranged to contain word2 as a prefix.
Maximize the Total Height of Unique Towers
Assign heights to towers ensuring each height is unique and the total sum is maximized using greedy sorting techniques.
Find the Lexicographically Smallest Valid Sequence
Determine the lexicographically smallest valid index sequence by using state transition dynamic programming over word1 a…
Count of Substrings Containing Every Vowel and K Consonants I
Count all substrings containing every vowel and exactly k consonants using a sliding window and hash map state tracking.
Count of Substrings Containing Every Vowel and K Consonants II
Count the number of substrings containing all vowels and exactly k consonants using a sliding window technique.
Maximum Possible Number by Binary Concatenation
Determine the largest number achievable by reordering three integers and concatenating their binary forms efficiently.
Remove Methods From Project
Remove suspicious methods in a project that are invoked directly or indirectly from a buggy method using graph traversal…
Construct the Minimum Bitwise Array II
Learn to build the minimum array matching a bitwise OR pattern for each prime in nums, focusing on binary optimization.
Find Maximum Removals From Source String
Determine the maximum number of characters you can remove from source while keeping pattern as a subsequence using array…
K-th Largest Perfect Subtree Size in Binary Tree
Find the size of the kth largest perfect subtree in a binary tree using tree traversal and state tracking.
Find the Sequence of Strings Appeared on the Screen
Simulate Alice typing a target string with a special keyboard that appends letters one by one. Solve using string simula…
Count Substrings With K-Frequency Characters I
Calculate the total number of substrings where at least one character repeats k times using a sliding window efficiently…
Minimum Division Operations to Make Array Non Decreasing
Determine the minimum number of division operations to make an array non-decreasing using a greedy and invariant-based s…
Find Subtree Sizes After Changes
Calculate the sizes of all subtrees after simultaneous parent changes using array scanning and hash-based counting effic…
Maximum Points Tourist Can Earn
Calculate the maximum points a tourist can earn by choosing optimal city moves over k days using state transition DP.
Find the Maximum Factor Score of Array
Calculate the maximum factor score of an integer array by optionally removing one element using LCM and GCD computations…
Total Characters in String After Transformations I
Calculate the total number of characters in a string after repeated transformations using dynamic programming and freque…
Find Minimum Time to Reach Last Room I
Find Minimum Time to Reach Last Room I challenges you to determine the minimum time to travel in a dungeon with a grid l…
Find Minimum Time to Reach Last Room II
Calculate the minimum time to reach the last room in a grid with alternating move times using array and graph patterns.
Maximum Frequency of an Element After Performing Operations I
Maximize the frequency of an element in an array after performing a series of operations to find the best possible resul…
Adjacent Increasing Subarrays Detection II
Find the largest k where two adjacent strictly increasing subarrays of length k exist using binary search techniques.
Zero Array Transformation I
Transform the given integer array into a zero array using range operations, focusing on prefix sum optimization and care…
Zero Array Transformation II
Zero Array Transformation II requires determining the minimum query sequence to convert all array elements to zero using…
Shift Distance Between Two Strings
Find the minimum cost of transforming one string into another, considering operations between characters.
Zero Array Transformation III
Zero Array Transformation III requires removing the minimum number of queries to make all elements zero using greedy val…
Rearrange K Substrings to Form Target String
Determine if s can be split into k equal substrings and rearranged to match t using a hash table for frequency tracking.
Minimum Array Sum
Solve the Minimum Array Sum problem using dynamic programming by tracking states and operations to minimize the sum of a…
Identify the Largest Outlier in an Array
Identify the largest outlier in an integer array using scanning and hash lookup for efficient detection and validation.
Maximize the Number of Target Nodes After Connecting Trees I
Maximize the number of target nodes after connecting two trees using binary tree traversal and state tracking.
Minimum Time to Break Locks I
Solve the Minimum Time to Break Locks I problem using state transition dynamic programming to minimize the time to break…
Digit Operations to Make Two Integers Equal
Transform n into m using allowed digit operations without creating primes, applying math and graph strategies efficientl…
Maximum Area Rectangle With Point Constraints I
Find the maximum area of a rectangle formed by given points on a plane with unique coordinates.
Maximum Subarray Sum With Length Divisible by K
Find the maximum sum of a subarray where the length of the subarray is divisible by k.
Maximize Amount After Two Days of Conversions
Compute the maximum currency amount after two days using graph traversal and depth-first search for optimal conversions.
Count Beautiful Splits in an Array
Learn to count all valid beautiful splits in an array using state transition dynamic programming efficiently and accurat…
Count Paths With the Given XOR Value
Count the number of paths in a grid where the XOR of all values along the path equals a given number.
Check if Grid can be Cut into Sections
Determine if an n x n grid can be divided with two horizontal or vertical cuts using rectangle ranges efficiently.
Maximum Number of Distinct Elements After Operations
Maximize distinct elements in an array by performing at most one operation on each element.
Find the Lexicographically Largest String From the Box I
This problem involves finding the lexicographically largest string from a given word using a two-pointer approach.
Count Special Subsequences
Count the number of special subsequences in an array of positive integers, focusing on efficient array scanning and hash…
Design Task Manager
Design a Task Manager that can efficiently handle task management operations such as adding, editing, executing, and rem…
Longest Subsequence With Decreasing Adjacent Difference
Find the length of the longest subsequence with non-increasing absolute adjacent differences.
Find Mirror Score of a String
Calculate the mirror score of a string using stack-based state management for matching letters efficiently and accuratel…
Maximum Coins From K Consecutive Bags
Solve the problem of maximizing coins from selecting k consecutive bags, using binary search and sliding window techniqu…
Maximum Amount of Money Robot Can Earn
Find the maximum amount of money a robot can collect while neutralizing robbers on its path in a grid.
Minimize the Maximum Edge Weight of Graph
Minimize the maximum edge weight in a graph after removing certain edges while ensuring node reachability.
Minimum Cost to Make Arrays Identical
Minimize cost to make arrays identical by performing operations with given constraints and a greedy strategy.
Maximum and Minimum Sums of at Most Size K Subsequences
Find the sum of the maximum and minimum elements of subsequences with at most k elements, using dynamic programming.
Paint House IV
Solve the Paint House IV problem using state transition dynamic programming to minimize the painting costs while adherin…
Count Mentions Per User
Calculate how many times each user is mentioned across MESSAGE events, accounting for offline and online statuses effici…
Maximum Frequency After Subarray Operation
Determine the maximum frequency of a target value k after applying one subarray addition operation efficiently using arr…
Reschedule Meetings for Maximum Free Time I
Maximize free time by rescheduling up to k non-overlapping meetings within a fixed event using sliding window updates.
Reschedule Meetings for Maximum Free Time II
Maximize free time by rescheduling at most one meeting using a greedy choice with invariant validation approach for arra…
Maximum Manhattan Distance After K Changes
Solve Maximum Manhattan Distance After K Changes by scanning prefixes and testing the four diagonal target pairs with li…
Sort Matrix by Diagonals
Sort Matrix by Diagonals groups cells by diagonal, then sorts bottom-left diagonals descending and top-right diagonals a…
Assign Elements to Groups with Constraints
Assign elements to groups by size constraints with a sieve-like approach to find suitable element matches efficiently.
Separate Squares I
Find the minimum y-coordinate of a horizontal line that balances the areas of squares above and below it.
Eat Pizzas!
Maximize the total weight gained by optimally eating pizzas in groups of four using greedy selection and invariant valid…
Select K Disjoint Special Substrings
Determine if k non-overlapping special substrings exist in a string using dynamic programming and careful substring trac…
Maximum Sum With at Most K Elements
Find the maximum sum by selecting at most k elements from a 2D matrix respecting per-row limits using a greedy strategy.
Find the Number of Copy Arrays
Find the number of possible arrays by leveraging bounds and math in this array-based problem.
Find Minimum Cost to Remove Array Elements
Find the minimum cost to remove all elements from the array with dynamic programming.
Longest Palindromic Subsequence After at Most K Operations
Find the longest palindromic subsequence of a string after performing at most k operations to adjust letters.
Sum of K Subarrays With Length at Least M
Maximize the sum of k non-overlapping subarrays of at least length m using dynamic programming and prefix sums efficient…
Choose K Elements With Maximum Sum
Choose K Elements With Maximum Sum involves sorting and selecting elements based on a specific rule, applying array plus…
Fruits Into Baskets III
Fruits Into Baskets III requires placing fruits into baskets efficiently using binary search over the answer space for c…
Design Spreadsheet
Design a spreadsheet that supports setting, retrieving, and resetting values, with the ability to handle formulas refere…
Closest Equal Element Queries
Find the nearest index with the same value for each query using array scanning combined with hash lookups efficiently.
Properties Graph
Find the number of connected components in an undirected graph formed by properties arrays, using array scanning and has…
Find the Minimum Amount of Time to Brew Potions
This problem involves calculating the minimum time required for wizards to brew potions based on their skills and mana u…
Maximize Active Section with Trade I
Maximize the number of active sections in a binary string by performing at most one trade operation.
Longest Palindrome After Substring Concatenation I
Compute the maximum palindrome length by concatenating substrings from two strings using state transition dynamic progra…
Implement Router
Efficiently design a Router class to manage network packets with memory limits using array scanning and hash lookups.
Number of Unique XOR Triplets I
Calculate all unique XOR triplet values in a permutation array using array traversal and bit manipulation techniques eff…
Number of Unique XOR Triplets II
Count all unique XOR results from triplets in an integer array using array traversal and bit manipulation techniques eff…
Smallest Palindromic Rearrangement I
Build the smallest palindrome by sorting the left half counts and mirroring them around the optional middle character.
Calculate Score After Performing Instructions
Simulate a series of add and jump instructions on arrays to compute the final score efficiently using array scanning and…
Make Array Non-decreasing
Determine the maximum size of a non-decreasing array by replacing subarrays with their maximum values efficiently.
Find X Value of Array I
Determine the x-value of an array using state transition dynamic programming to count valid prefix-suffix operations eff…
Find the Most Common Response
Find the most common survey response after eliminating duplicates within each day, using array scanning and hash lookups…
Unit Conversion I
Solve the unit conversion problem by using graph traversal to compute equivalent unit amounts.
Count Cells in Overlapping Horizontal and Vertical Substrings
Efficiently count grid cells appearing in both horizontal and vertical occurrences of a given string pattern using array…
Count Covered Buildings
Determine how many buildings in an n x n city are completely surrounded using array scanning and hash lookup efficiently…
Path Existence Queries in a Graph I
Determine if paths exist between nodes using array scanning and hash lookups for efficient component checks in graphs.
Fill a Special Grid
Fill a Special Grid uses recursive divide-and-conquer to populate a 2^n x 2^n matrix with sequential integers uniquely i…
Minimum Operations to Convert All Elements to Zero
Calculate the fewest operations to turn all numbers in an array to zero using subarray minimum elimination strategy.
Maximum Weighted K-Edge Path
Determine the maximum sum of edge weights for a k-edge path in a DAG using state transition dynamic programming efficien…
Equal Sum Grid Partition I
Determine if an m x n matrix grid can be split into two non-empty sections with equal sums by making a single horizontal…
Minimum Swaps to Sort by Digit Sum
Calculate the minimum swaps to sort an array by digit sum, ensuring correct order with tiebreaker values for efficiency.
Grid Teleportation Traversal
Find the minimum moves to traverse a 2D grid using standard steps and one-time portal teleports efficiently.
Sum of Largest Prime Substrings
Compute the sum of the three largest unique primes from all substrings using hash table plus math efficiently.
Find Maximum Number of Non Intersecting Substrings
Determine the maximum number of non-overlapping substrings in a word, each at least four characters and matching start-e…
Number of Ways to Assign Edge Weights I
Calculate the number of valid edge weight assignments in a tree using DFS and binary-tree traversal with careful state t…
Resulting String After Adjacent Removals
This problem focuses on removing adjacent characters in a string using a stack-based approach until no more operations a…
Partition Array into Two Equal Product Subsets
Determine if you can partition an array into two subsets with equal product using recursion and bit manipulation.
Minimum Absolute Difference in Sliding Submatrix
Find the minimum absolute difference in each k x k submatrix within a given 2D grid using array and sorting techniques.
Minimum Moves to Clean the Classroom
Solve the "Minimum Moves to Clean the Classroom" problem using array scanning and hash lookup for an optimized solution.
Maximize Y‑Sum by Picking a Triplet of Distinct X‑Values
Select three distinct x-values from arrays to maximize the sum of their corresponding y-values efficiently using hashing…
Best Time to Buy and Sell Stock V
Maximize profit from stock trades with at most k transactions using state transition dynamic programming for precise dec…
Transform Array to All Equal Elements
Transform Array to All Equal Elements requires careful greedy choices and validating invariants to achieve uniformity ef…
Count the Number of Computer Unlocking Permutations
Calculate the total valid unlocking sequences for computers based on their complexity using array and combinatorics logi…
Count Partitions With Max-Min Difference at Most K
Count the number of valid ways to partition an array into contiguous segments where max-min difference is at most k.
Count Special Triplets
Count Special Triplets requires scanning an array while tracking counts of previous and next values efficiently with has…
Maximum Product of First and Last Elements of a Subsequence
Maximize the product of the first and last elements of any subsequence of size m in an integer array.
Minimum Adjacent Swaps to Alternate Parity
Compute the minimum adjacent swaps to make array elements alternate between even and odd using greedy and invariant chec…
Find Maximum Area of a Triangle
Find the maximum area of a triangle from 2D coordinates with at least one side parallel to the x-axis or y-axis.
Count Prime-Gap Balanced Subarrays
Count the number of prime-gap balanced subarrays in an integer array using sliding window techniques and running state u…
Inverse Coin Change
Recover coin denominations from a numWays array using state transition dynamic programming to reconstruct valid sets eff…
Minimum Increments to Equalize Leaf Paths
Find the minimum number of increments needed to equalize leaf path scores in a tree with different node costs.
Partition String
Partition a string into unique segments using hash table and string manipulation.
Longest Common Prefix Between Adjacent Strings After Removals
Given an array of strings, find the longest common prefix length between adjacent strings after removals at each index.
Partition Array to Minimize XOR
Partition an integer array into k subarrays to minimize the maximum XOR using state transition dynamic programming effic…
Minimum Cost Path with Alternating Directions II
This problem focuses on finding the minimum cost path with alternating directions in a grid using dynamic programming.
Minimum Time to Reach Destination in Directed Graph
The problem involves finding the minimum time to reach the destination in a directed graph with time-dependent edges.
Power Grid Maintenance
Determine which power stations remain connected after maintenance using array scanning and hash lookups to track compone…
Minimum Time for K Connected Components
Find the minimum time to remove edges such that a graph with n nodes has at least k connected components.
Process String with Special Operations I
Simulate a series of operations on a string to transform it into the desired result using special characters.
Minimize Maximum Component Cost
Minimize Maximum Component Cost leverages binary search over edge weights to optimize the cost of graph components after…
Split Array by Prime Indices
Split Array by Prime Indices challenges you to separate elements at prime positions and minimize the absolute sum differ…
Count Islands With Total Value Divisible by K
Count the number of islands in a grid where the sum of each island's values is divisible by a given integer k.
Count Number of Trapezoids I
Given a list of distinct points, count the number of unique horizontal trapezoids that can be formed by selecting four p…
Find Stores with Inventory Imbalance
Solve Find Stores with Inventory Imbalance by comparing cheapest and most expensive product stock within each store.
Maximum Median Sum of Subsequences of Size 3
Maximize the sum of medians from subsequences of size 3 by choosing elements wisely from the array.
Maximum Number of Subsequences After One Inserting
Maximize the number of "LCT" subsequences in a string after one insertion of an uppercase letter.
Minimum Jumps to Reach End via Prime Teleportation
Solve the problem of finding the minimum jumps to reach the end of an array with prime teleportation steps.
Minimum Removals to Balance Array
Determine the fewest elements to remove from nums so the remaining array satisfies the maximum-to-minimum ratio within k…
Earliest Finish Time for Land and Water Rides II
Determine the minimum completion time for a tourist to ride one land and one water ride using optimal scheduling.
Maximum Balanced Shipments
The Maximum Balanced Shipments problem requires forming the maximum number of balanced shipments from a given set of par…
Minimum Time to Activate String
Find the minimum time to activate a string with a given order of replacements and a specific number of valid substrings.
Top Topics In This Track
Guided Practice Path
AI recommends problems by your level and tracks your progress.
Start Guided Patharrow_forward