# Tag Archives: Algorithms-Dynamic Programming

Given a Matrix of size N*N filled with 1‘s and 0‘s, the task is to find the maximum distance from a 0-cell to its nearest… Read More
A string is called good if it is made with only digits 0 to 9 and adjacent elements are different. The task is to find… Read More
Given an array arr[] and an integer K, the task is to find out the minimum product of a subsequence where adjacent elements of the… Read More
Given a N X N matrix consisting of characters. Also given are Q queries, where each query contains a co-ordinate (X, Y). For every query,… Read More
Given an integer N, the task is to find an aggregate sum of all integer partitions of this number such that each partition does not… Read More
Given two jugs with the maximum capacity of m and n liters respectively. The jugs don’t have markings on them which can help us to… Read More
Given a Directed Acyclic Graph with n vertices and m edges. The task is to find the number of different paths that exist from a… Read More
The tetranacci numbers are a generalization of the Fibonacci numbers defined by the recurrence relation  T(n) = T(n-1) + T(n-2) + T(n-3) + T(n-4) with T(0)=0,… Read More
In number theory, a weird number is a natural number that is abundant but not semiperfect. In other words, the sum of the proper divisors… Read More
Given N number of stairs. Also given the number of steps that one can cover at most in one leap (K). The task is to… Read More
Given two numbers N and K. Find the number of ways to represent N as the sum of K Fibonacci numbers. Examples:   Input : n =… Read More
Find the minimum number of single-digit prime numbers required whose sum will be equal to N. Examples:   Input: 11 Output: 3 Explanation: 5 + 3 +… Read More
Given N non-negative integers which signifies the cost of the moving from each stair. Paying the cost at i-th step, you can either climb one… Read More
Given an array of N positive integers write an efficient function to find the sum of all those integers which can be expressed as the… Read More
Given a tetrahedron(vertex are A, B, C, D), the task is to find the number of different cyclic paths with length n from a vertex.Note:… Read More