Skip to content

Category Archives: Dynamic Programming

There are some processes that need to be executed. The amount of load that process causes a server that runs it, is being represented by… Read More
Given an array arr[] consisting of N integers, the task is to print the length of the longest subarray with a positive product. Examples: Input:… Read More
Given two integers N and M where M and N denote a matrix of dimensions N * M consisting of 0‘s only. The task is… Read More
Grammar denotes the syntactical rules for conversation in natural language. But in the theory of formal language, grammar is defined as a set of rules… Read More
Given two integers N and T denoting the number of levels and the number of seconds respectively, the task is to find the number of… Read More
Given an array arr[] of N integers, the task is to find the maximum sum of the array that can be obtained by flipping signs… Read More
Given two integers M and N, the task is to find the minimum cost to convert M to N by repetitive addition of even divisors… Read More
Given an integer N, the task is to check if N can be expressed as a sum of integers having 9 as the last digit… Read More
Given an array arr[] having N integers. The task is to determine if the array can be partitioned into 3 subsequences of an equal sum… Read More
Given a 2D matrix mat[][] of size N*M and Q queries of the form {x1, y1, x2, y2, K}. For each query, the task is… Read More
Given a binary matrix arr[][] of dimensions M x N and Q queries of the form (x1, y1, x2, y2), where (x1, y1) and (x2,… Read More
Given an array arr[] of size N, the task is to print the longest bitonic subsequence of the given array.Note: If more than one solution… Read More
Given two Strings S and T of length N consisting of lowercase alphabets, which are permutations of each other, the task is to print the… Read More
Given two numbers N and M, the task is to find the minimum operations required to convert N to M by repeatedly adding it with… Read More
Given three arrays arr1[], arr2[] and arr3[] of length N1, N2 and N3 respectively, the task is to find the maximum sum possible by adding… Read More