Tag: greedy
- Add Minimum Number of Rungs
- Advantage Shuffle
- Append Characters to String to Make Subsequence
- Append K Integers With Minimal Sum
- Apple Redistribution into Boxes
- Apply Operations on Array to Maximize Sum of Squares
- Apply Operations to Make Sum of Array Greater Than or Equal to k
- Apply Operations to Maximize Score
- Array of Doubled Pairs
- Array Partition
- Array With Elements Not Equal to Average of Neighbors
- Assign Cookies
- Average Height of Buildings in Each Segment
- Avoid Flood in The City
- Bag of Tokens
- Balance a Binary Search Tree
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock with Transaction Fee
- Boats to Save People
- Break a Palindrome
- Broken Calculator
- Building Boxes
- Buy Two Chocolates
- Can Place Flowers
- Candy
- Check if a Parentheses String Can Be Valid
- Check If a String Can Break Another String
- Check if it is Possible to Split Array
- Check If String Is Transformable With Substring Sort Operations
- Cinema Seat Allocation
- Construct K Palindrome Strings
- Construct Smallest Number From DI String
- Construct String With Repeat Limit
- Construct the Longest New String
- Container With Most Water
- Count K-Subsequences of a String With Maximum Beauty
- Count Pairs of Equal Substrings With Minimum Difference
- Couples Holding Hands
- Course Schedule III
- Create Maximum Number
- Decrease Elements To Make Array Zigzag
- Delete Columns to Make Sorted II
- Design an ATM Machine
- Destroying Asteroids
- Determine the Minimum Sum of a k-avoiding Array
- DI String Match
- Distant Barcodes
- Distribute Money to Maximum Children
- Divide Array in Sets of K Consecutive Numbers
- Divide Array Into Arrays With Max Difference
- Divide Intervals Into Minimum Number of Groups
- Dota2 Senate
- Earliest Possible Day of Full Bloom
- Earliest Second to Mark Indices II
- Eat Pizzas!
- Eliminate Maximum Number of Monsters
- Equal Sum Arrays With Minimum Number of Operations
- Find Minimum Time to Finish All Jobs II
- Find Original Array From Doubled Array
- Find Permutation
- Find Polygon With the Largest Perimeter
- Find Servers That Handled Most Number of Requests
- Find the Largest Palindrome Divisible by K
- Find the Lexicographically Smallest Valid Sequence
- Find the Maximum Number of Marked Indices
- Find the Maximum Sum of Node Values
- Find the Minimum Number of Fibonacci Numbers Whose Sum Is K
- Find the Minimum Possible Sum of a Beautiful Array
- Find the Most Competitive Subsequence
- Find the String with LCP
- Find Valid Matrix Given Row and Column Sums
- Form Array by Concatenating Subarrays of Another Array
- Frequency of the Most Frequent Element
- Frog Jump II
- Furthest Building You Can Reach
- Gas Station
- Get the Maximum Score
- Greatest Sum Divisible by Three
- Group the People Given the Group Size They Belong To
- Hand of Straights
- How Many Apples Can You Put into the Basket
- Increasing Triplet Subsequence
- Integer Replacement
- IPO
- Jump Game II
- Jump Game
- K Items With the Maximum Sum
- Largest Element in an Array after Merge Operations
- Largest Merge Of Two Strings
- Largest Multiple of Three
- Largest Number After Mutating Substring
- Largest Number
- Largest Odd Number in String
- Largest Palindromic Number
- Largest Perimeter Triangle
- Largest Subarray Length K
- Largest Submatrix With Rearrangements
- Largest Values From Labels
- Latest Time by Replacing Hidden Digits
- Least Number of Unique Integers after K Removals
- Lemonade Change
- Lexicographically Minimum String After Removing Stars
- Lexicographically Smallest Beautiful String
- Lexicographically Smallest Generated String
- Lexicographically Smallest Palindrome
- Lexicographically Smallest String After a Swap
- Lexicographically Smallest String After Operations With Constraint
- Lexicographically Smallest String After Substring Operation
- Longest Binary Subsequence Less Than or Equal to K
- Longest Chunked Palindrome Decomposition
- Longest Happy String
- Longest Palindrome by Concatenating Two Letter Words
- Longest Palindrome
- Longest Subsequence Repeated k Times
- Longest Subsequence With Limited Sum
- Longest Unequal Adjacent Groups Subsequence I
- Make Array Empty
- Make Array Non-decreasing or Non-increasing
- Make Array Zero by Subtracting Equal Amounts
- Make Costs of Paths Equal in a Binary Tree
- Make K-Subarray Sums Equal
- Make String Anti-palindrome
- Make the Prefix Sum Non-negative
- Max Chunks To Make Sorted II
- Max Chunks To Make Sorted
- Max Difference You Can Get From Changing an Integer
- Max Increase to Keep City Skyline
- Maximal Score After Applying K Operations
- Maximize Greatness of an Array
- Maximize Happiness of Selected Children
- Maximize Number of Subsequences in a String
- Maximize Profit from Task Assignment
- Maximize Score After Pair Deletions
- Maximize Score of Numbers in Ranges
- Maximize Sum Of Array After K Negations
- Maximize the Beauty of the Garden
- Maximize the Distance Between Points on a Square
- Maximize the Minimum Game Score
- Maximize the Minimum Powered City
- Maximize the Topmost Element After K Moves
- Maximize the Total Height of Unique Towers
- Maximum 69 Number
- Maximum Area of a Piece of Cake After Horizontal and Vertical Cuts
- Maximum Array Hopping Score I
- Maximum Array Hopping Score II
- Maximum Average Pass Ratio
- Maximum Bags With Full Capacity of Rocks
- Maximum Binary String After Change
- Maximum Coins From K Consecutive Bags
- Maximum Difference by Remapping a Digit
- Maximum Distance in Arrays
- Maximum Elegance of a K-Length Subsequence
- Maximum Element After Decreasing and Rearranging
- Maximum Frequency After Subarray Operation
- Maximum Ice Cream Bars
- Maximum Length of Pair Chain
- Maximum Length of Subarray With Positive Product
- Maximum Matching of Players With Trainers
- Maximum Matrix Sum
- Maximum Number of Coins You Can Get
- Maximum Number of Consecutive Values You Can Make
- Maximum Number of Distinct Elements After Operations
- Maximum Number of Eaten Apples
- Maximum Number of Events That Can Be Attended
- Maximum Number of Groups Entering a Competition
- Maximum Number of Groups With Increasing Length
- Maximum Number of Integers to Choose From a Range I
- Maximum Number of Integers to Choose From a Range II
- Maximum Number of Non-overlapping Palindrome Substrings
- Maximum Number of Non-Overlapping Subarrays With Sum Equals Target
- Maximum Number of Non-Overlapping Substrings
- Maximum Number of Ones
- Maximum Number of Operations to Move Ones to the End
- Maximum Number of People That Can Be Caught in Tag
- Maximum Number of Potholes That Can Be Fixed
- Maximum Number of Tasks You Can Assign
- Maximum Number of Weeks for Which You Can Work
- Maximum Number That Makes Result of Bitwise AND Zero
- Maximum Odd Binary Number
- Maximum OR
- Maximum Palindromes After Operations
- Maximum Performance of a Team
- Maximum Points After Enemy Battles
- Maximum Price to Fill a Bag
- Maximum Product After K Increments
- Maximum Running Time of N Computers
- Maximum Score From Removing Stones
- Maximum Score From Removing Substrings
- Maximum Size of a Set After Removals
- Maximum Spending After Buying Items
- Maximum Split of Positive Even Integers
- Maximum Star Sum of a Graph
- Maximum Strength of a Group
- Maximum Subsequence Score
- Maximum Sum Obtained of Any Permutation
- Maximum Sum With at Most K Elements
- Maximum Sum With Exactly K Elements
- Maximum Swap
- Maximum Tastiness of Candy Basket
- Maximum Total Beauty of the Gardens
- Maximum Total Importance of Roads
- Maximum Unique Subarray Sum After Deletion
- Maximum Units on a Truck
- Maximum Value after Insertion
- Maximum Value at a Given Index in a Bounded Array
- Maximum White Tiles Covered by a Carpet
- Maximum Xor Product
- Meeting Rooms II
- Merge Operations to Turn Array Into a Palindrome
- Merge Triplets to Form Target Triplet
- Mice and Cheese
- Minimize Deviation in Array
- Minimize Length of Array Using Operations
- Minimize Maximum of Array
- Minimize Maximum Pair Sum in Array
- Minimize OR of Remaining Elements Using Operations
- Minimize Product Sum of Two Arrays
- Minimize Rounding Error to Meet Target
- Minimize the Maximum Adjacent Element Difference
- Minimize the Maximum Difference of Pairs
- Minimize XOR
- Minimized Maximum of Products Distributed to Any Store
- Minimizing Array After Replacing Pairs With Their Product
- Minimum Add to Make Parentheses Valid
- Minimum Addition to Make Integer Beautiful
- Minimum Additions to Make Valid String
- Minimum Adjacent Swaps for K Consecutive Ones
- Minimum Adjacent Swaps to Make a Valid Array
- Minimum Adjacent Swaps to Reach the Kth Smallest Number
- Minimum Amount of Damage Dealt to Bob
- Minimum Amount of Time to Fill Cups
- Minimum Array Length After Pair Removals
- Minimum Cost for Cutting Cake I
- Minimum Cost for Cutting Cake II
- Minimum Cost Homecoming of a Robot in a Grid
- Minimum Cost of Buying Candies With Discount
- Minimum Cost to Connect Sticks
- Minimum Cost to Equalize Array
- Minimum Cost to Hire K Workers
- Minimum Cost to Make All Characters Equal
- Minimum Cost to Make Array Equal
- Minimum Cost to Make Array Equalindromic
- Minimum Cost to Make Arrays Identical
- Minimum Cost to Move Chips to The Same Position
- Minimum Cost Tree From Leaf Values
- Minimum Deletions to Make Array Beautiful
- Minimum Deletions to Make Character Frequencies Unique
- Minimum Deletions to Make String K-Special
- Minimum Difference Between Largest and Smallest Value in Three Moves
- Minimum Division Operations to Make Array Non Decreasing
- Minimum Domino Rotations For Equal Row
- Minimum Elements to Add to Form a Given Sum
- Minimum Equal Sum of Two Arrays After Replacing Zeros
- Minimum Factorization
- Minimum Health to Beat Game
- Minimum Hours of Training to Win a Competition
- Minimum Increment to Make Array Unique
- Minimum Initial Energy to Finish Tasks
- Minimum Insertions to Balance a Parentheses String
- Minimum Money Required Before Transactions
- Minimum Moves to Convert String
- Minimum Moves to Get a Peaceful Board
- Minimum Moves to Pick K Ones
- Minimum Moves to Reach Target Score
- Minimum Non-Zero Product of the Array Elements
- Minimum Number of Arrows to Burst Balloons
- Minimum Number of Coins to be Added
- Minimum Number of Flips to Make the Binary String Alternating
- Minimum Number of Food Buckets to Feed the Hamsters
- Minimum Number of Groups to Create a Valid Assignment
- Minimum Number of Increments on Subarrays to Form a Target Array
- Minimum Number of Keypresses
- Minimum Number of Moves to Make Palindrome
- Minimum Number of Moves to Seat Everyone
- Minimum Number of Operations to Convert Time
- Minimum Number of Operations to Make Array Empty
- Minimum Number of Operations to Make Arrays Similar
- Minimum Number of People to Teach
- Minimum Number of Pushes to Type Word I
- Minimum Number of Pushes to Type Word II
- Minimum Number of Refueling Stops
- Minimum Number of Removals to Make Mountain Array
- Minimum Number of Seconds to Make Mountain Height Zero
- Minimum Number of Swaps to Make the Binary String Alternating
- Minimum Number of Swaps to Make the String Balanced
- Minimum Number of Taps to Open to Water a Garden
- Minimum Numbers of Function Calls to Make Target Array
- Minimum Operations to Form Subsequence With Target Sum
- Minimum Operations to Halve Array Sum
- Minimum Operations to Make a Special Number
- Minimum Operations to Make a Subsequence
- Minimum Operations to Make Array Equal II
- Minimum Operations to Make Array Equal to Target
- Minimum Operations to Make Binary Array Elements Equal to One II
- Minimum Operations to Make Columns Strictly Increasing
- Minimum Operations to Make Median of Array Equal to K
- Minimum Operations to Make the Array Alternating
- Minimum Operations to Make the Array Increasing
- Minimum Operations to Reduce an Integer to 0
- Minimum Possible Integer After at Most K Adjacent Swaps On Digits
- Minimum Processing Time
- Minimum Rectangles to Cover Points
- Minimum Replacements to Sort the Array
- Minimum Rounds to Complete All Tasks
- Minimum Score by Changing Two Elements
- Minimum Sideway Jumps
- Minimum Split Into Subarrays With GCD Greater Than One
- Minimum Subsequence in Non-Increasing Order
- Minimum Suffix Flips
- Minimum Sum of Four Digit Number After Splitting Digits
- Minimum Sum of Squared Difference
- Minimum Swaps to Arrange a Binary Grid
- Minimum Swaps to Make Strings Equal
- Minimum Time to Build Blocks
- Minimum Time to Complete All Tasks
- Minimum Time to Make Rope Colorful
- Minimum Time to Type Word Using Special Typewriter
- Minimum Total Cost to Make Arrays Unequal
- Monotone Increasing Digits
- Most Profit Assigning Work
- Non-overlapping Intervals
- Optimal Partition of String
- Pancake Sorting
- Partition Array Into Three Parts With Equal Sum
- Partition Array Such That Maximum Difference Is K
- Partition Labels
- Partition String Into Substrings With Values at Most K
- Partitioning Into Minimum Number Of Deci-Binary Numbers
- Patching Array
- Pizza With 3n Slices
- Previous Permutation With One Swap
- Prime Subtraction Operation
- Put Boxes Into the Warehouse I
- Put Boxes Into the Warehouse II
- Put Marbles in Bags
- Rabbits in Forest
- Reach End of Array With Max Score
- Rearrange Array to Maximize Prefix Score
- Rearrange String k Distance Apart
- Rearranging Fruits
- Reconstruct a 2-Row Binary Matrix
- Reduce Array Size to The Half
- Reducing Dishes
- Remove Adjacent Almost-Equal Characters
- Remove Colored Pieces if Both Neighbors are the Same Color
- Remove Digit From Number to Maximize Result
- Remove Duplicate Letters
- Remove K Digits
- Remove Stones to Minimize the Total
- Removing Minimum and Maximum From Array
- Removing Minimum Number of Magic Beans
- Reorganize String
- Replace Question Marks in String to Minimize Its Value
- Reschedule Meetings for Maximum Free Time I
- Reschedule Meetings for Maximum Free Time II
- Reverse Subarray To Maximize Array Value
- Score After Flipping Matrix
- Select K Disjoint Special Substrings
- Sell Diminishing-Valued Colored Balls
- Separate Black and White Balls
- Set Intersection Size At Least Two
- Shortest Distance After Road Addition Queries II
- Shortest Impossible Sequence of Rolls
- Shortest String That Contains Three Strings
- Shortest Unsorted Continuous Subarray
- Shortest Way to Form String
- Smallest Divisible Digit Product II
- Smallest K-Length Subsequence With Occurrences of a Letter
- Smallest Missing Non-negative Integer After Operations
- Smallest Number With Given Digit Product
- Smallest Range Covering Elements from K Lists
- Smallest Range II
- Smallest String With A Given Numeric Value
- Smallest Subsequence of Distinct Characters
- Sort Array by Moving Items to Empty Space
- Split a String in Balanced Strings
- Split Array into Consecutive Subsequences
- Split Array Into Maximum Number of Subarrays
- Split Array Largest Sum
- Split Concatenated Strings
- Split With Minimum Sum
- Stamping the Grid
- Stamping The Sequence
- Stone Game IX
- Stone Game VI
- String Without AAA or BBB
- Strong Password Checker
- Subsequence of Size K With the Largest Even Sum
- Sum Game
- Sum of Numbers With Units Digit K
- Super Washing Machines
- Task Scheduler
- The Number of Weak Characters in the Game
- The Wording Game
- Two City Scheduling
- Two Furthest Houses With Different Colors
- Using a Robot to Print the Lexicographically Smallest String
- Valid Palindrome II
- Valid Parenthesis String
- Valid Triangle Number
- Video Stitching
- Wiggle Sort II
- Wiggle Sort
- Wiggle Subsequence
- Wildcard Matching
- Word Abbreviation
- Zero Array Transformation III