# Category Archives: Dynamic Programming

Given a sequence arr of N positive integers, the task is to find the length of the longest subsequence such that xor of adjacent integers… Read More
Given N ropes, each rope has a length associated with it. At a time, only two consecutive small ropes tied at end form a large… Read More
Given an integer N, the task is to find the minimum number of coins required to create all the values in the range [1, N].… Read More
Given an array arr[] of N elements. The good value of an element arr[i] is the number of valid indices j<i such that arr[j] is… Read More
Given an array arr[] of N elements, the task is to find the maximum sum of any subarray of length X such that X >… Read More
Given an array arr[] of N integers and an integer M, the task is to find the number of non-empty subsequences such that the sum… Read More
Given a string S, the task is to find the number of ways to divide/partition the given string in sub-strings S1, S2, S3, …, Sk… Read More
Given a non-negative integer N, the task is to find the count of set bits for every number from 0 to N.Examples:   Input: N =… Read More
Given an array arr[], the task is to find the longest subsequence with a given OR value M. If there is no such sub-sequence then… Read More
Given an array arr[] and an integer M, the task is to find the longest subsequence with a given AND value M. If there is… Read More
Given an array arr[] and an integer M, the task is to find the length of the longest subsequence whose sum is divisible by M.… Read More
Given an array arr[] of length N and an integer X, the task is to find the number of subsets with a sum equal to… Read More
Given an array arr[] of length N, the task is to find the number of subsets with a given OR value M.Examples:  Input: arr[] =… Read More
Given an array arr of length N and an integer X, the task is to find the number of subsets whose AND value is X.Examples:  … Read More
In graph theory, vertex colouring is a way of labelling each individual vertex such that no two adjacent vertex have same colour. But we need… Read More