Skip to content

Tag Archives: Algorithms-Dynamic Programming

Given an integer N and a 2D array cost[][3], where cost[i][0], cost[i][1], and cost[i][2] is the cost of painting ith house with colors red, blue,… Read More
Given three integers N, A, and B, the task is to calculate the probability that the sum of numbers obtained on throwing the dice exactly… Read More
Given an array arr[] of size N and an integer K, the task is to find the maximum subarray sum by removing at most K… Read More
Given an array arr[] of N positive integers. The task is to find the length of the shortest sub-sequence such that the GCD of the… Read More
Give an integer N, the task is to find the minimum number of moves to reduce N to 0 by one of the following operations:… Read More
Given a string S of length N which only contains lowercase alphabets. Find the length of the longest substring of S such that the characters… Read More
Given an array arr[], the task is to find the elements of a contiguous subarray of numbers which has the largest sum. Examples: Input: arr… Read More
Given a matrix mat[][] with N rows and M columns. The task is to find the minimum number of changes required in the matrix such… Read More
Given an array arr[] of N positive integers, the task is to find the largest strictly increasing subsequence of arr[] such that the indices of… Read More