Given an array A[] having N positive integers, the task is to perform the following operations and maximize the sum obtained while reducing the array:… Read More
Category Archives: Dynamic Programming
There are N stairs, a person standing at the bottom wants to reach the top. The person can climb either 1 stair or 2 stairs… Read More
Given an array A[] of size N and a digit K. Find the number of sub-sequences of the array where the last digit of the… Read More
Given a matrix mat[][] of size N * M and an integer K, the task is to find a path from the top-left cell (0,… Read More
Given an array arr[] of size N, the task is to count the minimum number of elements required to be removed from the given array… Read More
Given a binary string str of size N containing 0 and 1 only, the task is to count all possible distinct binary strings when a… Read More
Given two strings A and B that are anagrams of each other, the task is to convert A to B if possible in minimum number… Read More
Given three strings, ‘X‘, ‘Y‘ and ‘Z‘, the task is to count the number of subsequences of ‘X‘ which is lexicographically greater than or equal… Read More
Given two integers N and H, the task is to find the count of distinct Binary Search Trees consisting of N nodes where the maximum… Read More
Given an array arr[] of size N, the task is to find the maximum possible sum of a subset of the array such that no… Read More
Given two strings A and B of size N and M respectively, where B is a sub-sequence of A and an array arr[] of size… Read More
Given two numbers N and K, the task is to count the number of all possible arrays of size N such that each element is… Read More
Given two integer arrays A[] and B[] of different length N and M respectively, the task is to choose any subsequence of same length from… Read More
Given an array nums[ ] and an integer target. Find whether there exists a combination of integers in nums[ ] such that their sum is… Read More
Given two arrays a[] and b[] of size N and M respectively (N < M), the task is to find the minimum possible sum of… Read More