Tag: dynamic-programming
- 01 Matrix
- 2 Keys Keyboard
- 4 Keys Keyboard
- Airplane Seat Assignment Probability
- All Possible Full Binary Trees
- Allocate Mailboxes
- Android Unlock Patterns
- Apply Operations to Make Two Strings Equal
- Arithmetic Slices II - Subsequence
- Arithmetic Slices
- As Far from Land as Possible
- Beautiful Arrangement
- Best Sightseeing Pair
- Best Team With No Conflicts
- Best Time to Buy and Sell Stock II
- Best Time to Buy and Sell Stock III
- Best Time to Buy and Sell Stock IV
- Best Time to Buy and Sell Stock with Cooldown
- Best Time to Buy and Sell Stock with Transaction Fee
- Best Time to Buy and Sell Stock
- Binary Tree Cameras
- Binary Tree Maximum Path Sum
- Binary Trees With Factors
- Bitwise ORs of Subarrays
- Bomb Enemy
- Build Array Where You Can Find The Maximum Exactly K Comparisons
- Burst Balloons
- Campus Bikes II
- Can I Win
- Cat and Mouse II
- Cat and Mouse
- Champagne Tower
- Cheapest Flights Within K Stops
- Check if an Original String Exists Given Two Encoded Strings
- Check if it is Possible to Split Array
- Check if There is a Path With Equal Number of 0's And 1's
- Check if There Is a Valid Parentheses String Path
- Check if There is a Valid Partition For The Array
- Cherry Pickup II
- Cherry Pickup
- Choose Edges to Maximize Score in a Tree
- Choose Numbers From Two Arrays in Range
- Climbing Stairs
- Closest Dessert Cost
- Closest Subsequence Sum
- Coin Change II
- Coin Change
- Coin Path
- Combination Sum IV
- Concatenated Words
- Constrained Subsequence Sum
- Construct String with Minimum Cost
- Construct the Longest New String
- Constructing Two Increasing Arrays
- Count All Possible Routes
- Count All Valid Pickup and Delivery Options
- Count Beautiful Numbers
- Count Beautiful Splits in an Array
- Count Different Palindromic Subsequences
- Count Fertile Pyramids in a Land
- Count Increasing Quadruplets
- Count K-Reducible Numbers Less Than N
- Count Number of Balanced Permutations
- Count Number of Possible Root Nodes
- Count Number of Special Subsequences
- Count Number of Teams
- Count Number of Texts
- Count Number of Ways to Place Houses
- Count Numbers With Unique Digits II
- Count Numbers with Unique Digits
- Count of Integers
- Count of Sub-Multisets With Bounded Sum
- Count Palindromic Subsequences
- Count Paths That Can Form a Palindrome in a Tree
- Count Paths With the Given XOR Value
- Count Sorted Vowel Strings
- Count Special Integers
- Count Square Submatrices with All Ones
- Count Stepping Numbers in Range
- Count Strictly Increasing Subarrays
- Count Submatrices With All Ones
- Count Substrings Divisible By Last Digit
- Count Substrings That Differ by One Character
- Count Subtrees With Max Distance Between Cities
- Count the Number of Ideal Arrays
- Count the Number of Inversions
- Count the Number of K-Free Subsets
- Count the Number of Powerful Integers
- Count the Number of Square-Free Subsets
- Count The Number of Winning Sequences
- Count The Repetitions
- Count Unique Characters of All Substrings of a Given String
- Count Valid Paths in a Tree
- Count Visited Nodes in a Directed Graph
- Count Vowels Permutation
- Count Ways To Build Good Strings
- Count Ways to Build Rooms in an Ant Colony
- Count Ways to Distribute Candies
- Count Ways to Make Array With Product
- Counting Bits
- Decode Ways II
- Decode Ways
- Decremental String Concatenation
- Delete and Earn
- Delete Columns to Make Sorted III
- Delete Operation for Two Strings
- Delivering Boxes from Storage to Ports
- Dice Roll Simulation
- Difference Between Maximum and Minimum Price Sum
- Different Ways to Add Parentheses
- Digit Count in Range
- Disconnect Path in a Binary Matrix by at Most One Flip
- Distinct Subsequences II
- Distinct Subsequences
- Distribute Repeating Integers
- Divisor Game
- Domino and Tromino Tiling
- Dungeon Game
- Edit Distance
- Egg Drop With 2 Eggs and N Floors
- Encode String with Shortest Length
- Equalize Strings by Adding or Removing Characters at Ends
- Extra Characters in a String
- Fair Distribution of Cookies
- Fibonacci Number
- Filling Bookcase Shelves
- Find All Good Indices
- Find All Good Strings
- Find All Possible Stable Binary Arrays I
- Find All Possible Stable Binary Arrays II
- Find Good Days to Rob the Bank
- Find Maximum Non-decreasing Array Length
- Find Maximum Removals From Source String
- Find Minimum Cost to Remove Array Elements
- Find Minimum Time to Finish All Jobs
- Find Number of Coins to Place in Tree Nodes
- Find Number of Ways to Reach the K-th Stair
- Find the City With the Smallest Number of Neighbors at a Threshold Distance
- Find the Count of Monotonic Pairs I
- Find the Count of Monotonic Pairs II
- Find the Derangement of An Array
- Find the Largest Palindrome Divisible by K
- Find the Lexicographically Smallest Valid Sequence
- Find the Maximum Length of a Good Subsequence I
- Find the Maximum Length of a Good Subsequence II
- Find the Maximum Length of Valid Subsequence I
- Find the Maximum Length of Valid Subsequence II
- Find the Maximum Number of Fruits Collected
- Find the Maximum Sequence Value of Array
- Find the Maximum Sum of Node Values
- Find the Minimum Cost Array Permutation
- Find the Number of K-Even Arrays
- Find the Number of Possible Ways for an Event
- Find the Number of Subsequences With Equal GCD
- Find the Original Typed String II
- Find the Shortest Superstring
- Find the String with LCP
- Find the Substring With Maximum Cost
- Find the Sum of Subsequence Powers
- Find the Sum of the Power of All Subsequences
- Find Two Non-overlapping Sub-arrays Each With Target Sum
- First Day Where You Have Been in All the Rooms
- Flip Game II
- Flip String to Monotone Increasing
- Form Largest Integer With Digits That Add up to Target
- Freedom Trail
- Frog Jump
- Game of Nim
- Generate Parentheses
- Get the Maximum Score
- Greatest Sum Divisible by Three
- Guess Number Higher or Lower II
- Handshakes That Don't Cross
- House Robber II
- House Robber III
- House Robber
- Integer Break
- Integer Replacement
- Interleaving String
- Is Subsequence
- Jump Game II
- Jump Game V
- Jump Game VI
- Jump Game VII
- Jump Game VIII
- Jump Game
- K-Concatenation Maximum Sum
- K Inverse Pairs Array
- Knight Dialer
- Knight Probability in Chessboard
- Kth Ancestor of a Tree Node
- Kth Smallest Instructions
- Largest 1-Bordered Square
- Largest BST Subtree
- Largest Color Value in a Directed Graph
- Largest Divisible Subset
- Largest Multiple of Three
- Largest Plus Sign
- Largest Sum of Averages
- Last Stone Weight II
- Least Operators to Express Number
- Length of Longest Fibonacci Subsequence
- Length of Longest V-Shaped Diagonal Segment
- Length of the Longest Subsequence That Sums to Target
- Longest Arithmetic Subsequence of Given Difference
- Longest Arithmetic Subsequence
- Longest Binary Subsequence Less Than or Equal to K
- Longest Chunked Palindrome Decomposition
- Longest Common Subsequence
- Longest Ideal Subsequence
- Longest Increasing Path in a Matrix
- Longest Increasing Subsequence II
- Longest Increasing Subsequence
- Longest Line of Consecutive One in Matrix
- Longest Mountain in Array
- Longest Non-decreasing Subarray From Two Arrays
- Longest Palindrome After Substring Concatenation I
- Longest Palindrome After Substring Concatenation II
- Longest Palindromic Subsequence After at Most K Operations
- Longest Palindromic Subsequence II
- Longest Palindromic Subsequence
- Longest Palindromic Substring
- Longest Repeating Substring
- Longest Square Streak in an Array
- Longest String Chain
- Longest Subarray of 1's After Deleting One Element
- Longest Subsequence With Decreasing Adjacent Difference
- Longest Turbulent Subarray
- Longest Unequal Adjacent Groups Subsequence I
- Longest Unequal Adjacent Groups Subsequence II
- Longest Valid Parentheses
- Longest ZigZag Path in a Binary Tree
- Make Array Non-decreasing or Non-increasing
- Make Array Strictly Increasing
- Make Costs of Paths Equal in a Binary Tree
- Make the XOR of All Segments Equal to Zero
- Matchsticks to Square
- Max Consecutive Ones II
- Max Dot Product of Two Subsequences
- Maximal Rectangle
- Maximal Square
- Maximize Consecutive Elements in an Array After Modification
- Maximize Grid Happiness
- Maximize Palindrome Length From Subsequences
- Maximize Score After N Operations
- Maximize Subarray Sum After Removing All Occurrences of One Element
- Maximize Sum of Weights after Edge Removals
- Maximize the Number of Partitions After Operations
- Maximize the Profit as the Salesman
- Maximize Total Cost of Alternating Subarrays
- Maximize Total Tastiness of Purchased Fruits
- Maximize Value of Function in a Ball Passing Game
- Maximum Absolute Sum of Any Subarray
- Maximum Alternating Subarray Sum
- Maximum Alternating Subsequence Sum
- Maximum Amount of Money Robot Can Earn
- Maximum and Minimum Sums of at Most Size K Subsequences
- Maximum AND Sum of Array
- Maximum Array Hopping Score I
- Maximum Balanced Subsequence Sum
- Maximum Coin Collection
- Maximum Compatibility Score Sum
- Maximum Cost of Trip With K Highways
- Maximum Deletions on a String
- Maximum Difference Score in a Grid
- Maximum Earnings From Taxi
- Maximum Energy Boost From Two Drinks
- Maximum Frequency After Subarray Operation
- Maximum Height by Stacking Cuboids
- Maximum Length of Pair Chain
- Maximum Length of Repeated Subarray
- Maximum Length of Subarray With Positive Product
- Maximum Multiplication Score
- Maximum Non Negative Product in a Matrix
- Maximum Number of Books You Can Take
- Maximum Number of Events That Can Be Attended II
- Maximum Number of Groups Getting Fresh Donuts
- Maximum Number of Jumps to Reach the Last Index
- Maximum Number of Moves in a Grid
- Maximum Number of Non-overlapping Palindrome Substrings
- Maximum Number of Operations With the Same Score II
- Maximum Number of Points with Cost
- Maximum Number of Removal Queries That Can Be Processed I
- Maximum Number That Sum of the Prices Is Less Than or Equal to K
- Maximum Points After Collecting Coins From All Nodes
- Maximum Points Tourist Can Earn
- Maximum Product of the Length of Two Palindromic Subsequences
- Maximum Product Subarray
- Maximum Profit From Trading Stocks
- Maximum Profit in Job Scheduling
- Maximum Repeating Substring
- Maximum Score After Applying Operations on a Tree
- Maximum Score From Grid Operations
- Maximum Score from Performing Multiplication Operations
- Maximum Score of Non-overlapping Intervals
- Maximum Score Of Spliced Array
- Maximum Score Words Formed by Letters
- Maximum Strength of a Group
- Maximum Strength of K Disjoint Subarrays
- Maximum Strictly Increasing Cells in a Matrix
- Maximum Students Taking Exam
- Maximum Subarray Sum After One Operation
- Maximum Subarray Sum with One Deletion
- Maximum Subarray
- Maximum Subtree of the Same Color
- Maximum Sum BST in Binary Tree
- Maximum Sum Circular Subarray
- Maximum Sum of 3 Non-Overlapping Subarrays
- Maximum Sum of Subsequence With Non-adjacent Elements
- Maximum Sum of Two Non-Overlapping Subarrays
- Maximum Total Damage With Spell Casting
- Maximum Total Reward Using Operations I
- Maximum Total Reward Using Operations II
- Maximum Vacation Days
- Maximum Value of K Coins From Piles
- Maximum Value Sum by Placing Three Rooks I
- Maximum Value Sum by Placing Three Rooks II
- Maximum XOR Score Subarray Queries
- Min Cost Climbing Stairs
- Minimize Maximum of Array
- Minimize the Difference Between Target and Chosen Elements
- Minimize the Total Price of the Trips
- Minimizing Array After Replacing Pairs With Their Product
- Minimum Additions to Make Valid String
- Minimum Array Sum
- Minimum ASCII Delete Sum for Two Strings
- Minimum Changes to Make K Semi-palindromes
- Minimum Cost for Cutting Cake I
- Minimum Cost For Tickets
- Minimum Cost Good Caption
- Minimum Cost to Change the Final Value of Expression
- Minimum Cost to Connect Two Groups of Points
- Minimum Cost to Convert String II
- Minimum Cost to Cut a Stick
- Minimum Cost to Divide Array Into Subarrays
- Minimum Cost to Make All Characters Equal
- Minimum Cost to Merge Stones
- Minimum Cost to Reach Destination in Time
- Minimum Cost to Separate Sentence Into Rows
- Minimum Cost to Split an Array
- Minimum Cost Tree From Leaf Values
- Minimum Costs Using the Train Line
- Minimum Deletions to Make String Balanced
- Minimum Difference in Sums After Removal of Elements
- Minimum Difficulty of a Job Schedule
- Minimum Distance to Type a Word Using Two Fingers
- Minimum Edge Reversals So Every Node Is Reachable
- Minimum Falling Path Sum II
- Minimum Falling Path Sum
- Minimum Flips in Binary Tree to Get Result
- Minimum Incompatibility
- Minimum Increment Operations to Make Array Beautiful
- Minimum Increments for Target Multiples in an Array
- Minimum Insertion Steps to Make a String Palindrome
- Minimum Jumps to Reach Home
- Minimum Moves to Spread Stones Over Grid
- Minimum Number of Coins for Fruits II
- Minimum Number of Coins for Fruits
- Minimum Number of Days to Eat N Oranges
- Minimum Number of Flips to Make the Binary String Alternating
- Minimum Number of Food Buckets to Feed the Hamsters
- Minimum Number of Increments on Subarrays to Form a Target Array
- Minimum Number of Lines to Cover Points
- Minimum Number of Operations to Make X and Y Equal
- Minimum Number of Operations to Satisfy Conditions
- Minimum Number of Refueling Stops
- Minimum Number of Removals to Make Mountain Array
- Minimum Number of Taps to Open to Water a Garden
- Minimum Number of Valid Strings to Form Target I
- Minimum Number of Valid Strings to Form Target II
- Minimum Number of Visited Cells in a Grid
- Minimum Number of Work Sessions to Finish the Tasks
- Minimum One Bit Operations to Make Integers Zero
- Minimum Operations to Make Array Equal to Target
- Minimum Operations to Make Binary Array Elements Equal to One II
- Minimum Operations to Make Character Frequencies Equal
- Minimum Operations to Make Elements Within K Subarrays Equal
- Minimum Operations to Reduce an Integer to 0
- Minimum Path Cost in a Grid
- Minimum Path Sum
- Minimum Score Triangulation of Polygon
- Minimum Sideway Jumps
- Minimum Skips to Arrive at Meeting On Time
- Minimum Split Into Subarrays With GCD Greater Than One
- Minimum Subarrays in a Valid Split
- Minimum Substring Partition of Equal Character Frequency
- Minimum Sum of Values by Dividing Array
- Minimum Swaps To Make Sequences Increasing
- Minimum Time to Break Locks I
- Minimum Time to Finish the Race
- Minimum Time to Kill All Monsters
- Minimum Time to Make Array Sum At Most x
- Minimum Time to Make Rope Colorful
- Minimum Time to Remove All Cars Containing Illegal Goods
- Minimum Total Distance Traveled
- Minimum Total Space Wasted With K Resizing Operations
- Minimum White Tiles After Covering With Carpets
- Minimum Window Subsequence
- Minimum XOR Sum of Two Arrays
- Most Expensive Item That Can Not Be Bought
- N-th Tribonacci Number
- New 21 Game
- Non-negative Integers without Consecutive Ones
- Non-overlapping Intervals
- Number of Beautiful Integers in the Range
- Number of Beautiful Partitions
- Number Of Corner Rectangles
- Number of Dice Rolls With Target Sum
- Number of Digit One
- Number of Distinct Roll Sequences
- Number of Good Binary Strings
- Number of Good Ways to Split a String
- Number of Great Partitions
- Number of Increasing Paths in a Grid
- Number of Longest Increasing Subsequence
- Number of Matching Subsequences
- Number of Music Playlists
- Number of Paths with Max Score
- Number of People Aware of a Secret
- Number of Restricted Paths From First to Last Node
- Number of Self-Divisible Permutations
- Number of Sets of K Non-Overlapping Line Segments
- Number of Smooth Descent Periods of a Stock
- Number of Squareful Arrays
- Number of Strings Which Can Be Rearranged to Contain Substring
- Number of Sub-arrays With Odd Sum
- Number of Subarrays Having Even Product
- Number of Subsequences with Odd Sum
- Number of Unique Good Subsequences
- Number of Ways of Cutting a Pizza
- Number of Ways to Arrive at Destination
- Number of Ways to Build House of Cards
- Number of Ways to Build Sturdy Brick Wall
- Number of Ways to Divide a Long Corridor
- Number of Ways to Earn Points
- Number of Ways to Form a Target String Given a Dictionary
- Number of Ways to Paint N × 3 Grid
- Number of Ways to Reach a Position After Exactly k Steps
- Number of Ways to Reach Destination in the Grid
- Number of Ways to Rearrange Sticks With K Sticks Visible
- Number of Ways to Reorder Array to Get Same BST
- Number of Ways to Select Buildings
- Number of Ways to Separate Numbers
- Number of Ways to Stay in the Same Place After Some Steps
- Number of Ways to Wear Different Hats to Each Other
- Numbers At Most N Given Digit Set
- Numbers With Repeated Digits
- Odd Even Jump
- Ones and Zeroes
- Optimal Account Balancing
- Optimal Division
- Out of Boundary Paths
- Paint Fence
- Paint House II
- Paint House III
- Paint House IV
- Paint House
- Painting a Grid With Three Different Colors
- Painting the Walls
- Palindrome Partitioning II
- Palindrome Partitioning III
- Palindrome Partitioning IV
- Palindrome Partitioning
- Palindrome Removal
- Palindromic Substrings
- Parallel Courses II
- Parallel Courses III
- Partition Array for Maximum Sum
- Partition Array Into Two Arrays to Minimize Sum Difference
- Partition Equal Subset Sum
- Partition String Into Minimum Beautiful Substrings
- Partition String Into Substrings With Values at Most K
- Partition to K Equal Sum Subsets
- Pascal's Triangle II
- Pascal's Triangle
- Paths in Matrix Whose Sum Is Divisible by K
- Perfect Squares
- Pizza With 3n Slices
- Poor Pigs
- Power of Heroes
- Predict the Winner
- Probability of a Two Boxes Having The Same Number of Distinct Balls
- Profitable Schemes
- Push Dominoes
- Race Car
- Reducing Dishes
- Regular Expression Matching
- Remove Adjacent Almost-Equal Characters
- Remove Boxes
- Restore The Array
- Rotate Function
- Rotated Digits
- Russian Doll Envelopes
- Scramble String
- Select Cells in Grid With Maximum Score
- Select K Disjoint Special Substrings
- Selling Pieces of Wood
- Sentence Screen Fitting
- Shopping Offers
- Shortest Common Supersequence
- Shortest Distance to Target Color
- Shortest Path Visiting All Nodes
- Sliding Puzzle
- Smallest Missing Genetic Value in Each Subtree
- Smallest Sufficient Team
- Solving Questions With Brainpower
- Sort Integers by The Power Value
- Sorting Three Groups
- Soup Servings
- Special Permutations
- Split Array Largest Sum
- Split Array With Same Average
- Stickers to Spell Word
- Stone Game II
- Stone Game III
- Stone Game IV
- Stone Game V
- Stone Game VII
- Stone Game VIII
- Stone Game
- Strange Printer
- String Compression II
- String Transformation
- Student Attendance Record II
- Subarrays Distinct Element Sum of Squares II
- Substring With Largest Variance
- Subtree Removal Game with Fibonacci Tree
- Sum of Consecutive Subarrays
- Sum of Consecutive Subsequences
- Sum of Distances in Tree
- Sum of Good Subsequences
- Sum of K Subarrays With Length at Least M
- Sum of Numbers With Units Digit K
- Sum Of Special Evenly-Spaced Elements In Array
- Sum of Subarray Minimums
- Super Egg Drop
- Super Ugly Number
- Tallest Billboard
- Target Sum
- The Earliest and Latest Rounds Where Players Compete
- The Most Similar Path in a Graph
- The Number of Beautiful Subsets
- The Number of Good Subsets
- The Number of Ways to Make the Sum
- The Score of Students Solving Math Expression
- Time Needed to Rearrange a Binary String
- Time Taken to Mark All Nodes
- Toss Strange Coins
- Total Appeal of A String
- Total Characters in String After Transformations I
- Total Characters in String After Transformations II
- Trapping Rain Water
- Triangle
- Two Best Non-Overlapping Events
- Ugly Number II
- Uncrossed Lines
- Unique Binary Search Trees II
- Unique Binary Search Trees
- Unique Paths II
- Unique Paths
- Unique Substrings in Wraparound String
- Valid Palindrome III
- Valid Parenthesis String
- Valid Permutations for DI Sequence
- Video Stitching
- Visit Array Positions to Maximize Score
- Vowels of All Substrings
- Ways to Express an Integer as Sum of Powers
- Ways to Split Array Into Good Subarrays
- Wiggle Subsequence
- Wildcard Matching
- Word Break II
- Word Break
- Zero Array Transformation IV
- Zuma Game