# Category Archives: Dynamic Programming

Two players X and Y are playing a game in which there are pots of gold arranged in a line, each containing some gold coins.… Read More
Given an array A[] of length N and integer F, the task is to find the number of subsequences where the average of the sum… Read More
Given an array arr[] of integers and an integer K, the task is to find the minimum number of operations required to make every Kth… Read More
Given arrays A[] and B[] of size N, the task is to count ways to form an array of size N such that the new… Read More
Given n stones and array heights[] and Geek is standing at stone 1 and can jump to one of the following: Stone i+1, i+2, …… Read More
Given an array of N elements, initially all a[i] = 0. Q queries need to be performed. Each query contains three integers l, r, and… Read More
There is a row of N walls in Geeksland. The king of Geeksland ordered Alexa to color all the walls on the occasion of New… Read More
Given an input array, the task is to convert the given array into an ‘even array’. An even array is an array where every number… Read More
Given an array, arr[] of size N, the task is to find the sum of the at most K non-overlapping contiguous subarray within an arr[]… Read More
Given an array arr[] of integers, the task is to find the length of the second longest increasing subsequence (LIS). Examples: Input: arr[] = {1,… Read More
Given array A[] of size N, array B[] of size M, and integer X, the task for this problem is to tell whether number X… Read More
Given an array arr[], find the maximum sum that can be achieved by picking a subsequence such that the difference between consecutive elements in the… Read More
Given an unweighted directed graph with N vertices and M edges and array A[] of size N. Given Q queries of the form (U, V),… Read More
Given a string S and a set of strings D, the task is to find the minimum number of deletions required to make the string… Read More
Given an array, arr[], and an integer K, the task is to find the total number of ways in which we can divide the array… Read More