Skip to content

Category Archives: Dynamic Programming

Given a rod of length N meters, and the rod can be cut in only 3 sizes A, B and C. The task is to… Read More
Given an undirected graph having N vertices and M edges and each vertex is associated with a cost and a source vertex S is given.… Read More
Given an array arr[] of N numbers. We can merge two adjacent numbers into one and the cost of merging the two numbers is equal… Read More
Given an array arr[] of N integers, and a range L to R, the task is to find the total number of elements in the… Read More
Given a string S of size N, the task is to count the occurrences of all the prefixes of the given string S. Examples:   Input:… Read More
Given an array arr[] consisting of N integers and an integer K, the task is to find the length of the longest subsequence with a… Read More
Given an integer Q representing the number of queries and an array where each query has an integer N. Our task is to iterate through… Read More
Given an integer array arr[] of size N, and Q queries of the form of {L, R, X}, the task is to find the smallest… Read More
Given an array arr[], we need to find the maximum sum of the even indexed elements that can be obtained by performing right shift operation… Read More
Given two arrays A[] and B[], each of size N, and two integers X and Y denoting the maximum number of elements that can be… Read More
Given N items with weights W[0..n-1], values V[0..n-1] and a knapsack with capacity C, select the items such that:   The sum of weights taken into… Read More

Start Your Coding Journey Now!