Skip to content

Category Archives: Dynamic Programming

Given a numeric string S consisting of only three types of characters 0, 1, and 2 initially and following two operations:   The occurrence of two… Read More
Given an array arr of length N and an integer K, the task is to count the number of possible subsequences of length at most… Read More
Given an integer K and a matrix mat[][] containing 1 and 0, where 1 denotes the cell is filled and 0 denotes an empty cell.… Read More
Given a matrix grid[][] and two integers M and N, the task is to find the sum of cost of all possible paths from the… Read More
Given two non-zero integers M and N, the problem is to compute the result of the Ackermann function based on some particular equations.  Ackermann function… Read More
Given a binary tree having N nodes and weight of N-1 edges. The distance between two nodes is the sum of the weight of edges… Read More
Given an N-ary tree with weighted edge and Q queries where each query contains two nodes of the tree. The task is to find the… Read More
Given three integers N, P and K, the task is to find the number of ways of painting K cells of 3 x N grid… Read More
Given a binary string S, the task is to partition the sequence into K non-empty subsets such that the sum of products of occurrences of… Read More
Given an integer N denoting the number of dices, the task is to find the probability of every possible value that can be obtained by… Read More
Given an array arr[] of length N, the task is to find the minimum number of prizes required such that if two elements are adjacent,… Read More
Dynamic Programming is one way which can be used as an optimization over plain recursion. Wherever we see a recursive solution that has repeated calls… Read More
Given an undirected graph of N vertices and M edges, the task is to assign directions to the given M Edges such that the graph… Read More
Given a triangular pyramid with its vertices marked as O, A, B and C and a number N, the task is to find the number… Read More