LeetCodechevron_rightCategorieschevron_rightgreedy
bolt

greedy

377 problems
Easy: 45Medium: 247Hard: 85

greedy is one of the most repeated interview dimensions. Start with edge-safe fundamentals, then move into pattern-level trade-offs.

Interview Signal

Frequently tests problem modeling, edge handling, and verbal clarity.

Common Pitfall

Template-only answers break under follow-up questioning.

Practice Strategy

Practice in 3-5 problem rounds and always review complexity alternatives.

Recommended Progression

#TitleDifficulty
11

Container With Most Water

Find two vertical lines that can form a container with the most water in a given array of heights.

Medium
44

Wildcard Matching

Implement full wildcard pattern matching using '?' and '*' by applying state transition dynamic programming with careful…

Hard
45

Jump Game II

Jump Game II requires finding the minimum jumps to reach the end of an array using dynamic programming and greedy techni…

Medium
55

Jump Game

Solve the Jump Game problem using state transition dynamic programming to determine if you can reach the last index of t…

Medium
122

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…

Medium
134

Gas Station

The Gas Station problem requires finding the starting station index for a full circular trip with gas stations and costs…

Medium
135

Candy

The Candy problem is a greedy algorithm challenge where you need to minimize candy distribution while satisfying certain…

Hard
179

Largest Number

The problem asks to arrange integers to form the largest possible number, focusing on greedy algorithms and string handl…

Medium
316

Remove Duplicate Letters

Remove duplicate letters from a string to produce the lexicographically smallest result using stack-based state manageme…

Medium
321

Create Maximum Number

Create Maximum Number involves merging digits from two arrays while preserving order, maximizing the resulting number.

Hard
324

Wiggle Sort II

Rearrange an array in a way that every odd-indexed element is greater than its adjacent even-indexed elements.

Medium
330

Patching Array

Patching Array requires adding the minimum numbers to cover all sums from 1 to n using greedy choices and invariant chec…

Hard
334

Increasing Triplet Subsequence

Identify if an array contains a strictly increasing triplet by maintaining a running minimal and middle value efficientl…

Medium
376

Wiggle Subsequence

Find the longest wiggle subsequence in an integer array using state transition dynamic programming with greedy optimizat…

Medium
397

Integer Replacement

Find the minimum number of operations to reduce a number to 1 by applying specific operations, using state transition dy…

Medium
402

Remove K Digits

Remove K Digits requires selecting which digits to drop using a monotonic stack for the smallest possible integer result…

Medium
409

Longest Palindrome

Determine the length of the longest palindrome constructible from a given string using greedy counting and frequency tra…

Easy
410

Split Array Largest Sum

Solve the 'Split Array Largest Sum' problem by minimizing the largest sum across k subarrays using dynamic programming a…

Hard
420

Strong Password Checker

The Strong Password Checker problem challenges you to optimize password strength while minimizing steps using greedy alg…

Hard
435

Non-overlapping Intervals

Determine the minimum number of intervals to remove from a list to ensure no intervals overlap using dynamic programming…

Medium
452

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.

Medium
455

Assign Cookies

Maximize content children by assigning at most one cookie per child using two-pointer scanning and greedy sorting techni…

Easy
502

IPO

Maximize total capital by selecting up to k projects, based on initial capital and project profits using a greedy strate…

Hard
517

Super Washing Machines

Calculate the minimum moves to balance dresses across washing machines using a greedy strategy and invariant validation …

Hard
561

Array Partition

Maximize the sum of minimums of n pairs in a 2n integer array using a greedy pairing strategy efficiently.

Easy
581

Shortest Unsorted Continuous Subarray

Find the shortest unsorted continuous subarray that, if sorted, would sort the entire array.

Medium
605

Can Place Flowers

Determine if n new flowers can be planted in a flowerbed, ensuring no adjacent flowers using a greedy approach.

Easy
611

Valid Triangle Number

Count all triplets in an integer array that satisfy the triangle inequality to form valid triangles efficiently using so…

Medium
621

Task Scheduler

Task Scheduler is solved by counting task frequencies and computing how cooldown gaps force idle slots around the most f…

Medium
624

Maximum Distance in Arrays

Maximum Distance in Arrays uses a greedy running minimum and maximum from previous arrays to validate cross array distan…

Medium
630

Course Schedule III

Solve the 'Course Schedule III' problem with a greedy approach involving course selection and validation of constraints.

Hard
632

Smallest Range Covering Elements from K Lists

Find the minimal range covering at least one number from each of k sorted lists using array scanning and hash lookup eff…

Hard
646

Maximum Length of Pair Chain

Determine the maximum length of a chain formed by pairs using dynamic programming and greedy sorting techniques efficien…

Medium
649

Dota2 Senate

The Dota2 Senate problem involves simulating voting rounds between Radiant and Dire senators until one party wins, using…

Medium
659

Split Array into Consecutive Subsequences

Verify if it's possible to split a sorted array into consecutive subsequences of length 3 or more.

Medium
670

Maximum Swap

Given an integer, swap at most two digits once to produce the largest possible number using greedy digit selection.

Medium
678

Valid Parenthesis String

Solve the Valid Parenthesis String problem by leveraging state transition dynamic programming to handle parentheses and …

Medium
680

Valid Palindrome II

Check if a string can become a palindrome by deleting at most one character using two-pointer scanning and invariant tra…

Easy
714

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…

Medium
738

Monotone Increasing Digits

Determine the largest number less than or equal to n with digits in non-decreasing order using a greedy, invariant-drive…

Medium
757

Set Intersection Size At Least Two

Solve the Set Intersection Size At Least Two problem using a greedy approach and invariant validation.

Hard
763

Partition Labels

Partition a string into maximal parts so that each letter appears in only one segment, using two-pointer scanning.

Medium
765

Couples Holding Hands

This problem requires arranging couples sitting apart in a row with the minimum number of swaps using graph traversal an…

Hard
767

Reorganize String

Reorganize a string so that no two adjacent characters are the same, if possible, using a greedy approach.

Medium
768

Max Chunks To Make Sorted II

Determine the maximum number of chunks you can split an array into so that sorting each chunk results in a fully sorted …

Hard
769

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…

Medium
781

Rabbits in Forest

Solve Rabbits in Forest by grouping equal answers and rounding each group into the smallest valid color-class size.

Medium
807

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…

Medium
826

Most Profit Assigning Work

Assign workers to jobs maximizing total profit using difficulty, profit, and worker arrays efficiently with binary searc…

Medium
846

Hand of Straights

Check if a hand of cards can be rearranged into groups of consecutive values.

Medium
857

Minimum Cost to Hire K Workers

Find the minimum cost to hire exactly k workers based on quality and wage expectations in this challenging greedy proble…

Hard
860

Lemonade Change

Determine if you can provide exact change to every customer at a lemonade stand using greedy bill management techniques.

Easy
861

Score After Flipping Matrix

Maximize the score of a binary matrix by flipping rows and columns using a greedy approach and validation of invariants.

Medium
870

Advantage Shuffle

Maximize the advantage of nums1 over nums2 using a two-pointer greedy strategy, carefully tracking which elements beat o…

Medium
871

Minimum Number of Refueling Stops

Determine the minimum number of refueling stops needed to reach a target using dynamic programming and greedy strategies…

Hard
881

Boats to Save People

Find the minimum number of boats required to save all people, using a two-pointer approach for efficient pairing.

Medium
910

Smallest Range II

Determine the minimum possible difference between the largest and smallest numbers after adjusting each by plus or minus…

Medium
921

Minimum Add to Make Parentheses Valid

Compute the minimum insertions needed to make a parentheses string valid using efficient stack-based state tracking tech…

Medium
936

Stamping The Sequence

Solve Stamping The Sequence with stack-based state management to convert string s to target using stamp efficiently.

Hard
942

DI String Match

Reconstruct a permutation from a DI string using two-pointer scanning, carefully tracking the increasing and decreasing …

Easy
945

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.

Medium
948

Bag of Tokens

Maximize your score in the Bag of Tokens problem by strategically playing tokens with two-pointer scanning and greedy te…

Medium
954

Array of Doubled Pairs

Given an array of even length, check if it can be reordered to satisfy a specific doubling condition.

Medium
955

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…

Medium
969

Pancake Sorting

Sort an array using pancake flips, leveraging two-pointer scanning and invariant tracking to iteratively position the la…

Medium
976

Largest Perimeter Triangle

Given an integer array, find the largest perimeter of a triangle formed from three of these lengths.

Easy
984

String Without AAA or BBB

Solve the problem of constructing a string without consecutive 'AAA' or 'BBB' by applying a greedy approach with invaria…

Medium
991

Broken Calculator

Compute the minimum operations to transform startValue into target using doubling and decrementing, leveraging a greedy …

Medium
1005

Maximize Sum Of Array After K Negations

Maximize the sum of an integer array after exactly k negations using a greedy approach and invariant tracking for optima…

Easy
1007

Minimum Domino Rotations For Equal Row

Minimize domino rotations to make either row identical in the problem of Minimum Domino Rotations For Equal Row.

Medium
1013

Partition Array Into Three Parts With Equal Sum

Determine if an array can be partitioned into three non-empty parts with equal sum using greedy choice and validation.

Easy
1024

Video Stitching

Solve the "Video Stitching" problem using state transition dynamic programming to cover a sporting event with minimum cl…

Medium
1029

Two City Scheduling

Two City Scheduling requires selecting optimal city assignments for 2n people to minimize total travel costs efficiently…

Medium
1053

Previous Permutation With One Swap

Find the lexicographically largest permutation smaller than the given array using exactly one swap, leveraging a greedy …

Medium
1054

Distant Barcodes

Rearrange barcodes in an array so that no two adjacent elements are equal, using a greedy approach and hash table for ef…

Medium
1081

Smallest Subsequence of Distinct Characters

The Smallest Subsequence of Distinct Characters problem asks you to find the lexicographically smallest subsequence of a…

Medium
1090

Largest Values From Labels

Maximize the sum of selected item values while respecting label use limits using array scanning and hash tracking.

Medium
1130

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…

Medium
1144

Decrease Elements To Make Array Zigzag

Transform any integer array into a zigzag pattern with minimal decrements using a targeted greedy approach and invariant…

Medium
1147

Longest Chunked Palindrome Decomposition

Solve the "Longest Chunked Palindrome Decomposition" problem by using dynamic programming and string manipulation techni…

Hard
1217

Minimum Cost to Move Chips to The Same Position

Compute the minimum cost to move all chips to one position using parity-based greedy moves efficiently.

Easy
1221

Split a String in Balanced Strings

Split a string into the maximum number of balanced substrings where each substring has an equal number of 'L' and 'R'.

Easy
1247

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…

Medium
1253

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…

Medium
1262

Greatest Sum Divisible by Three

Find the maximum sum divisible by three from a given array using dynamic programming and state transition.

Medium
1282

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…

Medium
1296

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…

Medium
1323

Maximum 69 Number

Maximize a number by flipping at most one digit from 6 to 9 or vice versa.

Easy
1326

Minimum Number of Taps to Open to Water a Garden

Determine the minimum number of taps to water an entire garden using state transition dynamic programming and interval c…

Hard
1328

Break a Palindrome

Given a palindrome, change exactly one character to make it non-palindromic and lexicographically smallest using a greed…

Medium
1330

Reverse Subarray To Maximize Array Value

Maximize the value of an array by reversing a subarray, focusing on greedy choices and invariant validation.

Hard
1338

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…

Medium
1353

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.

Medium
1363

Largest Multiple of Three

Find the largest number divisible by three by selecting and ordering digits optimally using state transition dynamic pro…

Hard
1382

Balance a Binary Search Tree

This problem requires balancing a binary search tree using in-order traversal and state tracking techniques.

Medium
1383

Maximum Performance of a Team

Maximize the performance of a team by selecting up to k engineers with the highest performance based on speed and effici…

Hard
1386

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…

Medium
1388

Pizza With 3n Slices

Maximize your pizza slice sum from a 3n-sized circular array using state transition dynamic programming efficiently.

Hard
1400

Construct K Palindrome Strings

Determine if a string's characters can be rearranged to form exactly k non-empty palindrome strings using greedy validat…

Medium
1402

Reducing Dishes

Maximize the sum of like-time coefficients by optimally choosing dishes to prepare in this dynamic programming problem.

Hard
1403

Minimum Subsequence in Non-Increasing Order

Find the minimum subsequence in non-increasing order such that its sum exceeds the sum of non-included elements.

Easy
1405

Longest Happy String

Solve the "Longest Happy String" problem using a greedy approach with validation of invariants for constructing the long…

Medium
1414

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.

Medium
1432

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.

Medium
1433

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.

Medium
1465

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.

Medium
1481

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…

Medium
1488

Avoid Flood in The City

This problem asks you to avoid flooding by deciding when to dry lakes between rain events.

Medium
1505

Minimum Possible Integer After at Most K Adjacent Swaps On Digits

Reorder digits using at most k adjacent swaps to produce the smallest possible integer, leveraging greedy selection effi…

Hard
1509

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.

Medium
1520

Maximum Number of Non-Overlapping Substrings

Find the maximum number of non-overlapping substrings in a given string, ensuring no two substrings intersect unless one…

Hard
1526

Minimum Number of Increments on Subarrays to Form a Target Array

The problem asks for the minimum number of operations to transform an initial array of zeros into a target array using s…

Hard
1529

Minimum Suffix Flips

Find the minimum number of operations to convert a binary string to a target string using bit flips.

Medium
1536

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…

Medium
1537

Get the Maximum Score

Find the maximum possible score from two sorted arrays with a dynamic programming approach, leveraging partitioning and …

Hard
1541

Minimum Insertions to Balance a Parentheses String

Compute the minimum insertions to transform a parentheses string into a balanced string using efficient stack tracking.

Medium
1546

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…

Medium
1558

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 …

Medium
1561

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…

Medium
1567

Maximum Length of Subarray With Positive Product

Given an array, find the maximum length of a subarray with a positive product using dynamic programming.

Medium
1578

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.

Medium
1585

Check If String Is Transformable With Substring Sort Operations

This problem requires checking if string 's' can be transformed into string 't' using substring sort operations.

Hard
1589

Maximum Sum Obtained of Any Permutation

Maximize the total sum of requests on nums by greedily assigning larger numbers to most frequently requested indices.

Medium
1605

Find Valid Matrix Given Row and Column Sums

Given row and column sums, find any valid matrix of non-negative integers that satisfies them.

Medium
1606

Find Servers That Handled Most Number of Requests

Given k servers and a series of requests, find the busiest server(s) using greedy strategies and efficient server tracki…

Hard
1642

Furthest Building You Can Reach

Furthest Building You Can Reach explores a greedy approach with heap-based optimization to find the maximum reachable bu…

Medium
1647

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…

Medium
1648

Sell Diminishing-Valued Colored Balls

Maximize total value by greedily selling diminishing-valued colored balls based on inventory and customer orders.

Medium
1663

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.

Medium
1665

Minimum Initial Energy to Finish Tasks

Determine the minimum initial energy needed to finish all tasks using a greedy ordering based on required versus actual …

Hard
1671

Minimum Number of Removals to Make Mountain Array

Solve the problem of finding the minimum number of removals to make a given array a mountain array using dynamic program…

Hard
1673

Find the Most Competitive Subsequence

Identify the lexicographically smallest subsequence of size k using stack-based greedy selection in array traversal.

Medium
1675

Minimize Deviation in Array

Given a positive integer array, repeatedly double or halve elements to minimize the difference between its largest and s…

Hard
1686

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 …

Medium
1689

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…

Medium
1702

Maximum Binary String After Change

The problem asks to maximize a binary string using specific operations to get the highest possible value.

Medium
1703

Minimum Adjacent Swaps for K Consecutive Ones

Find the minimum number of adjacent swaps to gather k consecutive ones in a binary array using sliding window logic.

Hard
1705

Maximum Number of Eaten Apples

Maximize apples eaten by choosing the best apples first, considering their rot days and available days to eat them.

Medium
1710

Maximum Units on a Truck

Maximize total units loaded on a truck by choosing boxes greedily based on highest units per box within truck capacity l…

Easy
1713

Minimum Operations to Make a Subsequence

Compute the minimum insertions required to transform arr so that target becomes its subsequence using array scanning and…

Hard
1717

Maximum Score From Removing Substrings

Compute the highest score by greedily removing specific substrings using a stack to track state transitions efficiently.

Medium
1727

Largest Submatrix With Rearrangements

Rearrange columns of a binary matrix to find the largest submatrix of 1s.

Medium
1733

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.

Medium
1736

Latest Time by Replacing Hidden Digits

Determine the latest valid time by replacing hidden digits using a greedy choice and invariant validation strategy effic…

Easy
1739

Building Boxes

Optimize the number of boxes touching the floor in a cubic room using binary search to minimize floor occupancy.

Hard
1753

Maximum Score From Removing Stones

Maximize the score in a solitaire game by optimally removing stones from three piles with a greedy approach.

Medium
1754

Largest Merge Of Two Strings

Construct the lexicographically largest merge from two strings using a two-pointer greedy scanning approach efficiently.

Medium
1764

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…

Medium
1775

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…

Medium
1785

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…

Medium
1792

Maximum Average Pass Ratio

Maximize the average pass ratio by assigning extra guaranteed-passing students using a greedy heap strategy for optimal …

Medium
1798

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.

Medium
1802

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.

Medium
1824

Minimum Sideway Jumps

Solve the Minimum Sideway Jumps problem using state transition dynamic programming to minimize side jumps while navigati…

Medium
1827

Minimum Operations to Make the Array Increasing

Calculate the minimum number of increments required to transform a given integer array into a strictly increasing sequen…

Easy
1833

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.

Medium
1838

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…

Medium
1846

Maximum Element After Decreasing and Rearranging

Determine the maximum value in an array after decreasing elements and rearranging using a greedy invariant approach.

Medium
1850

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.

Medium
1864

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…

Medium
1877

Minimize Maximum Pair Sum in Array

Minimize the maximum pair sum in an array by optimally pairing its elements.

Medium
1881

Maximum Value after Insertion

Solve Maximum Value after Insertion by greedily placing x at the first digit that makes the resulting signed number larg…

Medium
1899

Merge Triplets to Form Target Triplet

Determine if target triplet can be formed by merging given triplets using greedy selection and invariant checks.

Medium
1903

Largest Odd Number in String

Find the largest odd number in a string using a greedy approach with careful digit inspection and invariant checks.

Easy
1921

Eliminate Maximum Number of Monsters

Eliminate monsters by strategically using a weapon in a video game to stop them before they reach your city.

Medium
1927

Sum Game

Determine if Alice can force a win in the Sum Game by strategically replacing '?' using a greedy and invariant approach.

Medium
1936

Add Minimum Number of Rungs

Determine the fewest rungs to add to climb a strictly increasing ladder using a greedy step-by-step approach.

Medium
1946

Largest Number After Mutating Substring

Find the largest integer by mutating a substring of a number using a mapping array for each digit.

Medium
1953

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…

Medium
1962

Remove Stones to Minimize the Total

Minimize the total stones by repeatedly removing half from the largest pile using a greedy heap strategy.

Medium
1963

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.

Medium
1968

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.

Medium
1969

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…

Medium
1974

Minimum Time to Type Word Using Special Typewriter

Compute the minimum typing time by greedily taking the shorter circular move between consecutive letters, then adding on…

Easy
1975

Maximum Matrix Sum

Maximize the sum of an n x n integer matrix using row and column negation operations efficiently with a greedy approach.

Medium
1996

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…

Medium
2007

Find Original Array From Doubled Array

Given a shuffled array, determine if it is a doubled array and find the original array.

Medium
2014

Longest Subsequence Repeated k Times

Find the longest subsequence repeated k times in a string using backtracking search with pruning.

Hard
2027

Minimum Moves to Convert String

Minimize moves to convert a string of 'X' and 'O' to all 'O' by converting three consecutive characters to 'O'.

Easy
2029

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…

Medium
2030

Smallest K-Length Subsequence With Occurrences of a Letter

Find the lexicographically smallest subsequence of length k with at least repetition occurrences of a given letter using…

Hard
2037

Minimum Number of Moves to Seat Everyone

Calculate the minimum total moves to seat each student using greedy assignment and invariant validation efficiently.

Easy
2038

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.

Medium
2064

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.

Medium
2071

Maximum Number of Tasks You Can Assign

Maximize the number of tasks that can be completed by efficiently using workers and magical pills.

Hard
2078

Two Furthest Houses With Different Colors

Maximize the distance between two houses with different colors by using a greedy approach and validating the choice.

Easy
2086

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.

Medium
2087

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.

Medium
2091

Removing Minimum and Maximum From Array

The problem asks to remove the minimum and maximum elements from an array with the fewest deletions.

Medium
2116

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…

Medium
2126

Destroying Asteroids

This problem requires destroying asteroids by choosing the right order of collisions based on mass, using a greedy appro…

Medium
2131

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…

Medium
2132

Stamping the Grid

Determine if a binary grid can be fully covered using fixed-size stamps by applying a greedy placement and validation st…

Hard
2136

Earliest Possible Day of Full Bloom

Find the earliest day where all flower seeds are blooming based on their planting and growth times, using a greedy strat…

Hard
2139

Minimum Moves to Reach Target Score

Calculate the fewest steps to reach a target integer using increments and limited doubles with a greedy strategy.

Medium
2141

Maximum Running Time of N Computers

Solve the problem of determining the maximum running time of n computers using a set of batteries.

Hard
2144

Minimum Cost of Buying Candies With Discount

Minimize the total cost of buying candies using a greedy approach with a discount system based on candy prices.

Easy
2160

Minimum Sum of Four Digit Number After Splitting Digits

Find the minimum sum of two 2-digit numbers by splitting a four-digit number into two integers.

Easy
2170

Minimum Operations to Make the Array Alternating

Given an array, calculate the minimum number of operations needed to make it alternating.

Medium
2171

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.

Medium
2178

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…

Medium
2182

Construct String With Repeat Limit

Construct a lexicographically largest string from a given string with no letter appearing more than a repeatLimit times …

Medium
2193

Minimum Number of Moves to Make Palindrome

The problem challenges you to find the minimum number of adjacent swaps to make a string a palindrome.

Hard
2195

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.

Medium
2202

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.

Medium
2207

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.

Medium
2208

Minimum Operations to Halve Array Sum

Minimize operations to halve an array's sum using greedy choices and heap data structures.

Medium
2216

Minimum Deletions to Make Array Beautiful

Determine the minimum deletions required to transform an array into a beautiful sequence using stack-based state managem…

Medium
2224

Minimum Number of Operations to Convert Time

The problem asks to find the minimum number of operations to convert one time string to another using specific time incr…

Easy
2233

Maximum Product After K Increments

Maximize the product of an array after performing up to k increments using a greedy approach with heap optimization.

Medium
2234

Maximum Total Beauty of the Gardens

Determine the maximum total beauty of gardens by strategically planting flowers using binary search over achievable flow…

Hard
2241

Design an ATM Machine

Design an ATM machine that stores and withdraws money with given denominations and prioritizes larger values during with…

Medium
2244

Minimum Rounds to Complete All Tasks

The problem requires finding the minimum rounds to complete tasks, focusing on greedy algorithms and hash table lookups.

Medium
2259

Remove Digit From Number to Maximize Result

Determine the largest possible number by removing one specific digit using a greedy approach and string iteration.

Easy
2271

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…

Medium
2279

Maximum Bags With Full Capacity of Rocks

Maximize the number of bags filled to capacity by distributing additional rocks using a greedy approach.

Medium
2285

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…

Medium
2294

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 …

Medium
2310

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.

Medium
2311

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.

Medium
2333

Minimum Sum of Squared Difference

Calculate the minimum sum of squared differences between two arrays using limited modifications and binary search techni…

Medium
2335

Minimum Amount of Time to Fill Cups

Determine the minimum seconds to fill cups of cold, warm, and hot water using a greedy selection strategy and invariant …

Easy
2350

Shortest Impossible Sequence of Rolls

Find the shortest subsequence that cannot be formed from a sequence of dice rolls, with efficient array scanning and has…

Hard
2357

Make Array Zero by Subtracting Equal Amounts

Minimize operations to make all array elements zero by subtracting equal amounts in each operation.

Easy
2358

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…

Medium
2366

Minimum Replacements to Sort the Array

Minimize the number of operations to make the array sorted in non-decreasing order by replacing elements with sums of tw…

Hard
2375

Construct Smallest Number From DI String

Construct the lexicographically smallest string that fits the increasing and decreasing conditions of a given pattern.

Medium
2383

Minimum Hours of Training to Win a Competition

Find the minimum hours of training needed to beat all opponents in a competition based on energy and experience.

Easy
2384

Largest Palindromic Number

Form the largest palindromic number from a string of digits while maintaining a valid palindrome structure.

Medium
2389

Longest Subsequence With Limited Sum

Find the maximum size of a subsequence from nums with a sum less than or equal to each query value.

Easy
2405

Optimal Partition of String

Given a string s, partition it into substrings with unique characters and return the minimum number of substrings.

Medium
2406

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.

Medium
2410

Maximum Matching of Players With Trainers

Maximize the number of valid player-trainer matchings using two-pointer scanning and careful sorting strategy.

Medium
2412

Minimum Money Required Before Transactions

Find the minimum money required to complete all transactions in any order while considering cost and cashback.

Hard
2429

Minimize XOR

Minimize XOR problem asks for an integer that minimizes XOR with another, applying greedy choices for bit manipulation.

Medium
2434

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.

Medium
2439

Minimize Maximum of Array

Minimize Maximum of Array involves finding the smallest possible maximum value after applying a series of operations on …

Medium
2448

Minimum Cost to Make Array Equal

Find the minimum cost to make all elements of an array equal by using binary search over valid answers.

Hard
2449

Minimum Number of Operations to Make Arrays Similar

Determine the minimum operations to make two arrays similar by adjusting pairs while respecting element frequencies and …

Hard
2457

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.

Medium
2472

Maximum Number of Non-overlapping Palindrome Substrings

Find the maximum number of non-overlapping palindromic substrings of at least length k in a string using dynamic program…

Hard
2486

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…

Medium
2497

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 …

Medium
2498

Frog Jump II

Frog Jump II requires finding the minimal maximum jump length for a frog to traverse stones forward and backward efficie…

Medium
2499

Minimum Total Cost to Make Arrays Unequal

Calculate the minimum cost to rearrange nums1 so that no element matches nums2 using optimal swaps and hash counting.

Hard
2517

Maximum Tastiness of Candy Basket

Maximize the tastiness of a candy basket by choosing k candies from a list of candy prices.

Medium
2522

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 …

Medium
2528

Maximize the Minimum Powered City

Determine the maximum minimum power a city can achieve by strategically adding power stations using binary search and pr…

Hard
2530

Maximal Score After Applying K Operations

Maximize your score by applying exactly k operations on an array using greedy selection and heap optimization techniques…

Medium
2541

Minimum Operations to Make Array Equal II

Calculate the minimum operations to make two integer arrays equal using greedy adjustments with modular checks efficient…

Medium
2542

Maximum Subsequence Score

Maximize the score of a subsequence by selecting indices based on nums1 and nums2, using a greedy approach and sorting.

Medium
2551

Put Marbles in Bags

The "Put Marbles in Bags" problem challenges you to distribute marbles into bags for maximum score difference using gree…

Hard
2554

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.

Medium
2560

House Robber IV

House Robber IV requires calculating minimum maximum money the robber can take using state transition dynamic programmin…

Medium
2561

Rearranging Fruits

Solve the problem of rearranging fruit baskets by comparing fruit costs and minimizing swaps using array scanning and ha…

Hard
2566

Maximum Difference by Remapping a Digit

Find the largest difference by remapping a single digit in a number using a greedy approach to maximize and minimize out…

Easy
2567

Minimum Score by Changing Two Elements

The problem asks for the minimum score after changing two elements of an array using a greedy approach.

Medium
2571

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 …

Medium
2573

Find the String with LCP

Determine the lexicographically smallest string matching a given LCP matrix using state transition dynamic programming.

Hard
2576

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…

Medium
2578

Split With Minimum Sum

Split a positive integer into two parts to minimize their sum using a greedy approach and sorting.

Easy
2587

Rearrange Array to Maximize Prefix Score

Maximize the number of positive prefix sums by rearranging an integer array using a greedy, order-focused strategy.

Medium
2589

Minimum Time to Complete All Tasks

Determine the minimum active time for a computer to complete all scheduled tasks within their specific time windows effi…

Hard
2591

Distribute Money to Maximum Children

Determine the maximum number of children who can each receive exactly 8 dollars using a greedy approach with validation …

Easy
2592

Maximize Greatness of an Array

Maximize Greatness of an Array requires permuting numbers to exceed original values at most indices efficiently.

Medium
2598

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…

Medium
2600

K Items With the Maximum Sum

Select k items from a bag containing 1, 0, and -1 to maximize sum using greedy choice and invariant validation strategie…

Easy
2601

Prime Subtraction Operation

Determine if it's possible to make the array strictly increasing using prime subtractions.

Medium
2607

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.

Medium
2611

Mice and Cheese

In 'Mice and Cheese', you must maximize the total reward of two mice eating cheese while respecting their preferences an…

Medium
2616

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 …

Medium
2645

Minimum Additions to Make Valid String

Determine the minimum insertions required to transform a given string into repeated concatenations of 'abc' using dynami…

Medium
2656

Maximum Sum With Exactly K Elements

Maximize your score by performing exactly k operations on an array using a greedy approach to select the highest values.

Easy
2659

Make Array Empty

Solve the "Make Array Empty" problem using binary search to determine the minimum number of operations required.

Hard
2663

Lexicographically Smallest Beautiful String

Find the lexicographically smallest beautiful string larger than the given string using greedy choice and invariant vali…

Hard
2673

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.

Medium
2680

Maximum OR

Maximize the bitwise OR of an array by applying at most k multiplication operations on selected elements.

Medium
2697

Lexicographically Smallest Palindrome

Given a string, make it a palindrome with the fewest operations, prioritizing lexicographically smallest result.

Easy
2706

Buy Two Chocolates

Determine the leftover money after buying exactly two chocolates using a greedy selection and sum validation approach.

Easy
2708

Maximum Strength of a Group

Maximize the strength of a student group by carefully selecting students based on their scores, using dynamic programmin…

Medium
2712

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.

Medium
2734

Lexicographically Smallest String After Substring Operation

Given a string, perform operations to make it lexicographically smaller using a greedy approach with substring modificat…

Medium
2745

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.

Medium
2789

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.

Medium
2790

Maximum Number of Groups With Increasing Length

Maximize the number of groups that can be formed with given usage limits, leveraging binary search for optimal solutions…

Hard
2800

Shortest String That Contains Three Strings

Find the shortest string containing three given strings using a greedy approach while ensuring it is lexicographically s…

Medium
2811

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…

Medium
2813

Maximum Elegance of a K-Length Subsequence

Maximize elegance of a k-length subsequence from a list of items with profits and categories.

Hard
2818

Apply Operations to Maximize Score

Maximize the score by applying operations on a subarray at most k times, utilizing stack-based state management.

Hard
2829

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.

Medium
2834

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.

Medium
2835

Minimum Operations to Form Subsequence With Target Sum

The problem requires finding the minimum number of operations to form a subsequence summing to a target using powers of …

Hard
2842

Count K-Subsequences of a String With Maximum Beauty

Determine the number of k-length unique subsequences in a string that maximize the sum of character frequencies efficien…

Hard
2844

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.

Medium
2856

Minimum Array Length After Pair Removals

This problem involves minimizing the length of a sorted array by repeatedly removing adjacent pairs of equal elements.

Medium
2864

Maximum Odd Binary Number

Rearrange a binary string to form the largest odd binary number using a greedy approach and least significant bit valida…

Easy
2870

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.

Medium
2871

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…

Medium
2895

Minimum Processing Time

Determine the minimum total processing time by optimally assigning tasks to multiple processors using a greedy approach.

Medium
2897

Apply Operations on Array to Maximize Sum of Squares

Maximizing the sum of squares in an array through bitwise operations on selected elements.

Hard
2900

Longest Unequal Adjacent Groups Subsequence I

Find the longest alternating subsequence in a string array based on a binary group array.

Easy
2910

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.

Medium
2918

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…

Medium
2931

Maximum Spending After Buying Items

Maximize spending by carefully choosing the right items across multiple shops over m * n days.

Hard
2938

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…

Medium
2939

Maximum Xor Product

Find the maximum value of (a XOR x) * (b XOR x) using greedy bitwise choices and invariant validation.

Medium
2952

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.

Medium
2957

Remove Adjacent Almost-Equal Characters

Minimize operations to remove adjacent almost-equal characters using dynamic programming and greedy methods.

Medium
2966

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.

Medium
2967

Minimum Cost to Make Array Equalindromic

Determine the minimum cost to convert an integer array into a palindromic array using allowed element modifications effi…

Medium
2971

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…

Medium
3002

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.

Medium
3012

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.

Medium
3014

Minimum Number of Pushes to Type Word I

Calculate the minimum pushes to type a word using a remapped telephone keypad with greedy allocation of letters.

Easy
3016

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.

Medium
3022

Minimize OR of Remaining Elements Using Operations

Minimize the bitwise OR of the remaining elements of an array after applying at most k operations.

Hard
3035

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…

Medium
3049

Earliest Second to Mark Indices II

This problem asks to determine the earliest second at which all indices in an array can be marked using a sequence of op…

Hard
3068

Find the Maximum Sum of Node Values

Solve Find the Maximum Sum of Node Values by tracking XOR gain parity, not by simulating edge operations across the tree…

Hard
3074

Apple Redistribution into Boxes

Distribute packs of apples into boxes using a greedy strategy, minimizing the number of boxes selected efficiently and c…

Easy
3075

Maximize Happiness of Selected Children

Maximize the happiness of selected children by choosing the k happiest ones and applying greedy strategies to minimize l…

Medium
3081

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…

Medium
3085

Minimum Deletions to Make String K-Special

Minimize deletions to make a string k-special by adjusting character frequencies.

Medium
3086

Minimum Moves to Pick K Ones

Find the minimum number of moves to pick exactly k ones from a binary array, considering a constraint on changes.

Hard
3091

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.

Medium
3106

Lexicographically Smallest String After Operations With Constraint

Minimize a string lexicographically using a series of operations constrained by a given integer k.

Medium
3107

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…

Medium
3111

Minimum Rectangles to Cover Points

Find the minimum number of rectangles needed to cover all points, given constraints on width and position.

Medium
3139

Minimum Cost to Equalize Array

Compute the minimum cost to make all elements equal using selective operations guided by greedy choices and invariant ch…

Hard
3170

Lexicographically Minimum String After Removing Stars

Find the lexicographically smallest string by removing stars using stack-based state management and careful character se…

Medium
3192

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…

Medium
3207

Maximum Points After Enemy Battles

Solve the "Maximum Points After Enemy Battles" problem by maximizing points through greedy choices with energy validatio…

Medium
3216

Lexicographically Smallest String After a Swap

Lexicographically Smallest String After a Swap involves finding the smallest string after swapping adjacent digits with …

Easy
3218

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.

Medium
3219

Minimum Cost for Cutting Cake II

Solve Minimum Cost for Cutting Cake II by choosing optimal cuts using a greedy strategy while tracking cost increments p…

Hard
3228

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.

Medium
3229

Minimum Operations to Make Array Equal to Target

This problem requires calculating the minimum number of operations to transform one array into another using state trans…

Hard
3244

Shortest Distance After Road Addition Queries II

The problem involves calculating the shortest path from city 0 to city n-1 after each road addition, leveraging greedy c…

Hard
3260

Find the Largest Palindrome Divisible by K

Compute the largest n-digit integer divisible by k that forms a palindrome using state transition dynamic programming te…

Hard
3273

Minimum Amount of Damage Dealt to Bob

Minimize the total damage dealt to Bob using power to eliminate enemies efficiently with greedy approach.

Hard
3281

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…

Medium
3282

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.

Medium
3296

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.

Medium
3301

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.

Medium
3302

Find the Lexicographically Smallest Valid Sequence

Determine the lexicographically smallest valid index sequence by using state transition dynamic programming over word1 a…

Medium
3326

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…

Medium
3348

Smallest Divisible Digit Product II

Find the smallest zero-free number at least as large as num whose digits multiply to a product divisible by t using care…

Hard
3357

Minimize the Maximum Adjacent Element Difference

Minimize the maximum adjacent element difference by filling missing values with two chosen numbers.

Hard
3362

Zero Array Transformation III

Zero Array Transformation III requires removing the minimum number of queries to make all elements zero using greedy val…

Medium
3397

Maximum Number of Distinct Elements After Operations

Maximize distinct elements in an array by performing at most one operation on each element.

Medium
3402

Minimum Operations to Make Columns Strictly Increasing

Calculate the minimum increments to make each column of a matrix strictly increasing using a greedy invariant approach.

Easy
3413

Maximum Coins From K Consecutive Bags

Solve the problem of maximizing coins from selecting k consecutive bags, using binary search and sliding window techniqu…

Medium
3424

Minimum Cost to Make Arrays Identical

Minimize cost to make arrays identical by performing operations with given constraints and a greedy strategy.

Medium
3434

Maximum Frequency After Subarray Operation

Determine the maximum frequency of a target value k after applying one subarray addition operation efficiently using arr…

Medium
3439

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.

Medium
3440

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…

Medium
3449

Maximize the Minimum Game Score

Maximizing the minimum score after at most m moves, leveraging binary search and greedy strategies over an array of scor…

Hard
3457

Eat Pizzas!

Maximize the total weight gained by optimally eating pizzas in groups of four using greedy selection and invariant valid…

Medium
3458

Select K Disjoint Special Substrings

Determine if k non-overlapping special substrings exist in a string using dynamic programming and careful substring trac…

Medium
3462

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.

Medium
3464

Maximize the Distance Between Points on a Square

Select k points on a square boundary to maximize minimum Manhattan distance using binary search and greedy placement str…

Hard
3474

Lexicographically Smallest Generated String

Generate the lexicographically smallest string by merging str1 and str2 using a greedy approach with invariant checks.

Hard
3487

Maximum Unique Subarray Sum After Deletion

Maximize the sum of a subarray after performing deletions, ensuring elements remain unique.

Easy
3523

Make Array Non-decreasing

Determine the maximum size of a non-decreasing array by replacing subarrays with their maximum values efficiently.

Medium
3534

Path Existence Queries in a Graph II

Solve path existence queries in a graph using binary search on the answer space, focusing on sorted nodes and maximum di…

Hard
3542

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.

Medium
3545

Minimum Deletions for At Most K Distinct Characters

You need to delete characters in a string to reduce its distinct characters to at most k.

Easy
3547

Maximum Sum of Edge Values in a Graph

Maximize the sum of edge values in a connected graph by assigning unique node values and optimizing edge products.

Hard
3557

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…

Medium
3572

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…

Medium
3576

Transform Array to All Equal Elements

Transform Array to All Equal Elements requires careful greedy choices and validating invariants to achieve uniformity ef…

Medium
3579

Minimum Steps to Convert String with Operations

Transform word1 into word2 using minimal operations on substrings with a dynamic programming state transition approach.

Hard
3587

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…

Medium
3588

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.

Medium
3600

Maximize Spanning Tree Stability with Upgrades

Maximizing the stability of a spanning tree with upgrades requires careful optimization of edge strengths using binary s…

Hard
3605

Minimum Stability Factor of Array

The problem requires finding the minimum stability factor of an array by utilizing binary search and math-based optimiza…

Hard
3630

Partition Array for Maximum XOR and AND

Partition the array into three subsequences to maximize XOR and AND operations with a greedy approach.

Hard

Related Patterns

Greedy LeetCode Problems: 377 Solutions