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
Category Archives: Dynamic Programming
Given an array arr[] of length N and an integer X, the task is to find the number of subsets with sum equal to X.Examples: … 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.… 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
Given a string str of length N. The task is to find the number of integers obtained by replacing ‘?’ with any digit such that… Read More
Count number of ways to arrange the first N natural numbers in a line such that the left-most number is always 1 and no two… Read More
Given an array arr[] of N integers, the task is to sort the array in non-decreasing order by performing the minimum number of operations. In… Read More
Given an array arr[] of N integers, the task is to find and print the Longest Increasing Subsequence.Examples: Input: arr[] = {12, 34, 1, 5,… Read More
Given N lecture timings, with their start time and end time (both inclusive), the task is to find the minimum number of halls required to… Read More
Given an array arr[] and an integer K, the task is to partition the array into K non-empty groups where each group is a subarray… Read More
Given a binary matrix of size N * M, the task is to find the largest area sub-matrix such that all elements in it are… Read More
An ordered set of integers is said to be a special set if for every element of the set X, the set does not contain… Read More
Given two integers N and M and the task is to convert N to M with the following operations: Multiply N by 2 i.e. N… Read More