# 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