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

## Iterative approach to print all permutations of an Array

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 »

## Maximum sum of non-overlapping subarrays of length atmost K

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 »

## Iterative approach to print all combinations of an Array

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 »

## Longest sub-sequence that satisfies the given conditions

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 »

## Maximum subset sum such that no two elements in set have same digit in them

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 »

## Number of ways to choose elements from the array such that their average is K

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 »

## Subset with sum closest to zero

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 »

## Maximize the happiness of the groups on the Trip

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 »

## Maximum items that can be filled in K Knapsacks of given Capacity

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 »

## 0-1 knapsack queries

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 »

## Minimize the sum after choosing elements from the given three arrays

Given three arrays A[], B[] and C[] of same size N. The task is to minimize the sum after choosing N elements from these array… Read More »

## Maximise array sum after taking non-overlapping sub-arrays of length K

Given an integer array arr[] of length N and an integer K, the task is to select some non-overlapping sub-arrays such that each sub-array is… Read More »

## Find maximum path sum in a 2D matrix when exactly two left moves are allowed

Given a 2D matrix arr[][] of dimensions N * M where N is number of rows and M is number of columns.The task is to… Read More »

## Paths from entry to exit in matrix and maximum path sum

Given a maze which is a N * N grid grid[][]. Every cell of the maze contains either the number 1, 2 or 3 which… Read More »

## Maximise matrix sum by following the given Path

Given a 2d-matrix mat[][] consisting of positive integers, the task is to find the maximum score we can reach if we have to go to… Read More »