Tag: dynamic-programming
All the problems with the tag "dynamic-programming".
-
Leetcode 2781 - Length of the Longest Valid Substring
Given a string and an array of forbidden substrings, find the length of the longest valid substring of the string.
-
Leetcode 1567 - Maximum Length of Subarray With Positive Product
Given an array of integers, find the maximum length of a subarray where the product of all its elements is positive.
-
Leetcode 42 - Trapping Rain Water
Given an elevation map, compute how much water it can trap after raining.
-
Leetcode 322 - Coin Change
Given an array of coin denominations and a total amount, determine the minimum number of coins needed to make up that amount, or return -1 if it's not possible.
-
Leetcode 70 - Climbing Stairs
Determine the number of distinct ways to climb to the top of a staircase with 'n' steps, where each time you can climb 1 or 2 steps.
-
Leetcode 152 - Maximum Product Subarray
Given an integer array nums, find a subarray that has the largest product, and return the product.
-
Leetcode 53 - Maximum Subarray
Given an integer array nums, find the subarray with the largest sum and return its sum.
-
Leetcode 121 - Best Time to Buy and Sell Stock
You want to maximize your profit by choosing a single day to buy one stock and a different day in the future to sell that stock. Return the maximum profit you can achieve from this transaction.