# Category Archives: Dynamic Programming

Given an array of size N. The task is to partition the given array into two subsets such that the average of all the elements… Read More
The standard Tower of Hanoi problem is explained here . In the standard problem, all the disc transactions are considered identical. Given a 3×3 matrix… Read More
Given an array arr[] of length N ≥ 2. The task is to remove an element from the given array such that the GCD of… Read More
Given an array arr[] of N elements, the task is to find the length of the smallest sub-array which has the sequence {0, 1, 2,… Read More
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
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
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
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
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
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
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
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
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
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
Given infinite number of elements of form and ( n >= 0 ). The task is to find the minimum count of elements chosen such that there… Read More