# Category Archives: Dynamic Programming

Given the number N, count the number of ways to create a binary string (the string that contains characters as zero or one) of size… Read More
Given an array arr[] of size N, the task is to find the maximum sum of a subset of the array such that the sum… Read More
Given a tree with N node and N-1 edges and an array arr[] where arr[i] denotes the value of ith node, the task is to find… Read More
Jon and Arya are playing a game. The rules of the game are as follows: They have a single number N initially. Both will play… Read More
Given two integer arrays A[] and B[] of length N and M respectively, the task is to find the minimum number of operations required such… Read More
Given a string S and a positive integer K, The task is to maximize the product of the length of non-overlapping palindromic substrings each of… Read More
Given an array arr[] of size, N, the task is to maximize the score to reduce the array to a single element by replacing any… Read More
Given integer N and values P and Q, The task is to calculate the minimum number of powers of P and Q required to generate… Read More
Given the cost[] and profit[] of N stocks and K tickets, the task is to find the maximum total profit that can be obtained from… Read More
Greedy algorithm, divide and conquer algorithm, and dynamic programming algorithm are three common algorithmic paradigms used to solve problems. Here’s a comparison among these algorithms:… Read More
Given a matrix mat[][] of size N * M, and Q queries each of type {L, R} that denotes a range of row [L, R].… Read More
Given a tree with N nodes where node 1 is the root, the task is to solve the queries of form {u, k} and find… Read More
Given a string S (‘a’ ≤ S[i] ≤ ‘t’) of length N (1 ≤ N ≤ 105), which consists of lowercase English alphabets, the task… Read More
There is only one room which is holding N meetings that are given as intervals of the form (start[i], end[i], people[i]) where start[i] is the… Read More
Dynamic Programming (DP) is defined as a technique that solves some particular type of problems in Polynomial Time. Dynamic Programming solutions are faster than the… Read More