# Category Archives: Dynamic Programming

Given binary string str of size N, the task is to remove the minimum number of characters from the given binary string such that the… Read More
Given a positive integer K and a matrix grid of dimensions N * M consisting of characters ‘.’ and ‘#’, where ‘.’ represents the unblocked… Read More
Given two arrays arr1[] and arr2[] having N integers in non-decreasing order, the task is to find the count of non-decreasing arrays arr3[] of length… Read More
Type I: At most one transaction is allowed Given an array prices[] of length N, representing the prices of the stocks on different days, the… Read More
Given an array of integers arr[], find the subsequence with maximum sum whose elements are first decreasing, then increasing, or vice versa, The subsequence can… Read More
Given an array arr[] of size N. The task is to find the maximum score that can be achieved by alternative minus – plus of… Read More
Given two integers N and K, the task is to find the count of sequences of K elements from the range [1, N] where every… Read More
Given an array arr[] of length N and an integer X, the task is to find the number of subsets with a sum equal to… Read More
Given string str, the task is to find the minimum number of characters to be inserted to convert it to a palindrome. Before we go… Read More
Given string str, the task is to find the minimum number of characters to be inserted to convert it to a palindrome. Before we go… Read More
Given string str, the task is to find the minimum number of characters to be inserted to convert it to a palindrome. Before we go… Read More
Given a positive number N, the task is to find the number of ways to reach N from 2 wherein each operation one of the… Read More
Given an array arr[] consisting of values (0, 1, 2, 3) of length N, representing the type of work that can be done on any… Read More
Given a string S of size N and an array queries, containing Q queries in the form of L, R. The task is to find… Read More
Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum.    Recommended: Please… Read More