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

# Category Archives: Dynamic Programming

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

Given two integers N and K, the task is to find the count of all the integer in base K which satisfy the following conditions: … Read More

Given an integer N. The task is to find the number in the range from 1 to N-1 which is having the maximum number of… Read More

Given an array arr[] of N integers, the task is to find the count of all the subsets which do not contain adjacent elements from… Read More

Given a positive integer N, the task is to count the total number of set bits in binary representation of all the numbers from 1… Read More

Given a matrix of integers mat[][] of size N * M. The task is to find the maximum perimeter of a square in the matrix.… Read More

Consider a row of n coins of values v1 . . . vn, where n is even. We play a game against an opponent by… Read More