# Category Archives: Dynamic Programming

Given a 2D square matrix of size N X N, the task is to count the number of mountains in the matrix.   An element in… Read More
Given two numbers N and K. A sequence A1, A2, ….AN of length N can be created by placing numbers from 1 to K at… Read More
Given an array arr[][] of size M X N where M represents the number of tasks and N represents number of iteration. An entry in… Read More
Prerequisites: Digit-DP Given string str that represents a large number, the task is to find the minimum number of segments the given string can be divided… Read More
Given two numbers M, D, and an array arr[] which represents the range [L, R], the task is to count the numbers in the range… Read More
Given a string str that represents a large number, the task is to find the minimum number of segments the given string can be divided… Read More
Prerequisites: Dynamic Programming, DigitDPGiven two integers N and K. The task is to find the number of integers between 1 and N (inclusive) that contains… Read More
Prerequisites: Digit DP Given a range [L, R], the task is to count the numbers in this range having the difference between, the sum of… Read More
Given an array arr[] of N integers, the task is to sort the array in increasing order by performing minimum number of operations. In a… Read More
Given a string S, the task is to count the maximum occurrence of subsequences in the given string such that the indices of the characters… Read More
Given an array arr[] of length N, the task is to maximize the sum of all the elements of the array by performing the following… Read More
Given two positive integers N and K, the task is to count the number of positive integers D such that D has N digits and… Read More
Given an integer N, the task is to find the Nth pure number.   A pure number has to satisfy three conditions: 1) It has an even… Read More
Given three integers X, Y and P, the task is to find the minimum window size K such that every window in the range [X,… Read More
Given a string S, the task is to count the number of ways to partition the string into two non-empty parts such that both the… Read More