Given two strings X and Y consisting of only digits ‘0’ to ‘9’. Find minimum cost required to make the given two strings identical. Only… Read More

# Category Archives: Dynamic Programming

This is an extended version of the subset sum problem. Here we need to find the size of the maximum size subset whose sum is… Read More

Given a matrix containing an integer value, In which each cell of the matrix represents height of building. Find minimum jumps needed reach from First… Read More

Given n, find count of n digit Stepping numbers. A number is called stepping number if all adjacent digits have an absolute difference of 1.… Read More

Given a sequence, print a longest palindromic subsequence of it. Examples : Input : BBABCBCAB Output : BABCBAB The above output is the longest palindromic subsequence… Read More

Round 1: Place all numeric characters in string before alphabet characters . Using min swaps and O(1) space and Maintain the order of characters. Round… Read More

Given an array of positive distinct integer denoting the crossing time of ‘n’ people. These ‘n’ people are standing at one side of bridge. Bridge… Read More

We have to paint n boards of length {A1, A2…An}. There are k painters available and each takes 1 unit time to paint 1 unit… Read More

Given a number of at most 100 digits. We have to check if it is possible, after removing certain digits, to obtain a number of… Read More

Given a 2D array, find the minimum sum submatrix in it. Examples: Input : M[][] = {{1, 2, -1, -4, -20}, {-8, -3, 4, 2,… Read More

Given an array and a number k, find a subsequence such that Sum of elements in subsequence is maximum Indices of elements of subsequence differ… Read More

Given an array of n integers and q queries, print the number of next greater elements to the right of the given index element. Examples: Input:… Read More

Given a string S, find the length of the longest balanced subsequence in it. A balanced string is defined as:- A null string is a… Read More

A stable tower of height n is a tower consisting of exactly n tiles of unit height stacked vertically in such a way, that no… Read More

Consider a coding competition on geeksforgeeks practice. Now their are n distinct participants taking part in the competition. A single participant can make pair with… Read More