# Category Archives: Dynamic Programming

Given an integer W, arrays val[] and wt[], where val[i] and wt[i] are the values and weights of the ith item, the task is to… Read More
Given a positive integer N, the task is to find the number of binary strings of length N that are repeated concatenation of only one… Read More
Given a positive integer N, the task is to find the number of all N-digit numbers whose adjacent digits have equal Greatest Common Divisor(GCD). Examples:… Read More
Given a positive integer N, the task is to count the number of N-digit numbers such that every index (1-based indexing) in the number is… Read More
Given an array arr[] of positive integers representing prices of stocks and an integer transactionFee, the task is to find the maximum profit possible after… Read More
Given two binary strings A and B of size N and M respectively, the task is to maximize the value of the length of (X)… Read More
Given an array arr[] consisting of N positive integers such that arr[i] denotes the size of the ith group sitting in a donut shop and… Read More
Given an array arr[] of size N, the task is to find the maximum alternating sum of a subarray possible for a given array.  Alternating… Read More
Given two binary strings A and B of length N, the task is to count the minimum number of operations required to make the two… Read More
Given an integer N and an array arr[ ] of size N, the task is to find the maximum jumps to reach the end of… Read More
Given a positive integer N, the task is to find the number of N-digit numbers such that at least one digit in the number has… Read More
Given a positive integer K, and an array arr[] consisting of N( =9) integers such that arr[i] represents the cost of the digit (i+1), the… Read More
Given an array arr[] consisting of N integers, the task is to find the longest subsequence such that the prefix sum at each position of… Read More
Given a positive integer N, the task is to find the number of N-digit numbers such that every digit is smaller than its adjacent digits.… Read More
Given a sorted array arr[] consisting of N positive integers such that arr[i] represent the days in which a worker will work and an array… Read More