# Category Archives: Dynamic Programming

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
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
Given a string str, the task is to find the number of odd length palindromic sub-sequences around of str with str[i] as center i.e. every… Read More
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
Given an array arr[] of size N, the task is to generate and print all permutations of the given array. Examples: Input: arr[] = {1,… Read More
Given an integer array ‘arr’ of length N and an integer ‘k’, select some non-overlapping subarrays such that each sub-array if of length at most… Read More
Given an array arr[] of size N, the task is to generate and print all possible combinations of R elements in array. Examples: Input: arr[]… Read More
Given an array arr[] of N integers, the task is to find the longest sub-sequence in the given array such that for all pairs from… Read More
Given an array of N elements. Find the subset of elements which has maximum sum such that no two elements in the subset has common… Read More
Given an array arr[] of N integers and an integer K. The task is to find the number of ways to select one or more… Read More
Given an array ‘arr’ consisting of integers, the task is to find the non-empty subset such that its sum is closest to zero i.e. absolute… Read More
A trip to mystical land is going to be organized in ByteLand, the city of Bytes. Unfortunately, there are limited seats say A and there… Read More
Given an integer array W[] consisting of weights of items and ‘K’ knapsacks of capacity ‘C’, find maximum weight we can put in the knapsacks… Read More
Given an integer array W[] consisting of weights of the items and some queries consisting of capacity C of knapsack, for each query find maximum… Read More