Skip to content

Category Archives: Dynamic Programming

Given an array of n elements. Make strictly increasing and strictly decreasing subsequences from the array such that each array element belongs to increasing subsequence… Read More
Given a knapsack weight W and a set of n items with certain value vali and weight wti, we need to calculate the maximum amount… Read More
For a given number n > 0, find the number of different ways in which n can be written as a sum of at two… Read More
Given an array of n elements and an integer k. The task is to find the count of subarray which has maximum element greater than… Read More
Given a set of integers, find a distinct sum that can be generated from the subsets of the given sets and print them in increasing… Read More
Given an array of integers. A subsequence of arr[] is called Bitonic if it is first increasing, then decreasing. Examples :   Input : arr[] = {1,… Read More
Super ugly numbers are positive numbers whose all prime factors are in the given prime list. Given a number n, the task is to find… Read More
Given an array of n positive integers. Initially we are at first position. We can jump to position y (1 <= y <= n) from… Read More
Given a maze with obstacles, count number of paths to reach rightmost-bottommost cell from topmost-leftmost cell. A cell in given maze has value -1 if… Read More
Given an array arr[] of positive integers. The task is to find minimum sum subsequence from the array such that at least one value among… Read More
Given an array of strings and costs of reversing all strings, we need to sort the array. We cannot move strings in array, only string… Read More
Given an expression which contains numbers and two operators ‘+’ and ‘*’, we need to find maximum and minimum value which can be obtained by… Read More
Given a matrix containing lower alphabetical characters only, we need to count number of palindromic paths in given matrix. A path is defined as a… Read More
Given an array, we need to find maximum sum subarray, removing one element is also allowed to get the maximum sum. Examples :  Input :… Read More
Given binary square matrix [n*n]. Find maximum integer value in a path from top left to bottom right. We compute integer value using bits of… Read More