# Category Archives: Dynamic Programming (adsbygoogle = window.adsbygoogle || []).push({});

## Find minimum length sub-array which has given sub-sequence in it

Given an array arr[] of N elements, the task is to find the length of the smallest sub-array which has sequence {0, 1, 2, 3,… Read More »

## Count of integers of length N and value less than K such that they contain digits only from the given set

Given a set of digits A[] in sorted order and two integers N and K, the task is to find how many numbers of length… Read More »

## Mobile Numeric Keypad Problem | Set 2

Given the mobile numeric keypad. You can only press buttons that are up, left, right or down to the current button or can choose to… Read More »

## Longest Consecuetive Subsequence when only one insert operation is allowed

Given a sequence of positive integers of length N. The only operation allowed is to insert a single integer of any value at any position… Read More »

## Minimum time required to rot all oranges | Dynamic Programming

Given a matrix of dimension m * n where each cell in the matrix can have values 0, 1 or 2 which has the following… Read More »

## Coin Change | BFS Approach

Given an integer X and an array arr[] of length N consisting of positive integers, the task is to pick minimum number of integers from… Read More »

## Optimally accommodate 0s and 1s from a Binary String into K buckets

Given a binary string S, consisting of 0’s and 1’s. You have to accommodate the 0’s and 1’s into the K buckets in such a… Read More »

## Flip minimum signs of array elements to get minimum sum of positive elements possible

Given an array of positive elements, you have to flip the sign of some of its elements such that the resultant sum of the elements… Read More »

## Count numbers in given range such that sum of even digits is greater than sum of odd digits

Given two integers L and R denoting a range [L, R]. The task is to find the total count of numbers in the given range… Read More »

## Maximum sub-sequence sum such that indices of any two adjacent elements differs at least by 3

Given an array arr[] of integers, the task is to find the maximum sum of any sub-sequence in the array such that any two adjacent… Read More »

## Probability of getting more heads than tails when N biased coins are tossed

Given an array p[] of odd length N where p[i] denotes the probability of getting a head on the ith coin. As the coins are… Read More »

## Minimum count of elements that sums to a given number

Given infinte number of elements of form and ( n >= 0 ). The task is to find the minimum count of elements chosen such… Read More »

## Number of ways to get a given sum with n number of m-faced dices

Given n dices each with m faces, numbered from 1 to m, find the number of ways to get a given sum X. X is… Read More »

## Total number of odd length palindrome sub-sequence around each centre

Given a string str, the task is to find the number of odd length palindromic sub-sequences around of str with str[i] as centre i.e. every… Read More »

## Number of sub-sequence such that it has one consecutive element with difference less than or equal to 1

Given an array arr[] of N elements. The task is to find the number of sub-sequences which have at least two consecutive elements such that… Read More »