Given an undirected graph with V vertices and E edges, the task is to find the maximum contiguous subarray sum among all the connected components… Read More

# Category Archives: Dynamic Programming

Given a positive integer array arr[] of size N, the task is to find the maximum sum of a subsequence with the constraint that no… Read More

Given binary string str, the task is to find the minimum number of flips required to keep all 1s together in the given binary string,… Read More

Given an array arr[] of size N, the task is to find the longest increasing sub-sequence such that index of any element is divisible by… Read More

Given three integers, N, K and M. The task is to find out the number of binary strings of length N which always starts with… Read More

Given a tree, and the weights of all the node. Each query contains two integers u and v, the task is to find the minimum… Read More

Given four positive integer N, K, L, and R, the task is to split N as sum of K numbers lying in the range [L,… Read More

Given a 2-D array of N rows and M columns and an integer K. The task is to find whether is it possible to take… Read More

Given a binary matrix M where each element of the matrix will be 0 or 1, the task is to find the largest square that… Read More

Given an array arr[] consisting of positive integers, the task is to check whether we can modify the array by adding any of the elements… Read More

A number can always be represented as a sum of squares of other numbers. Note that 1 is a square, and we can always break… Read More

Given a digit sequence S, the task is to find the number of possible decodings of the given digit sequence where 1 represents ‘A’, 2… Read More

Given an integer array arr[] of N distinct elements and a positive integer K ( K <= N ). The task is to calculate the… Read More

Given an array arr[] of positive numbers, find the maximum sum of a subsequence with the constraint that no 2 numbers in the sequence should… Read More