Given the prices of stock for n number of days. Every ith day tell the price of the stock on that day. Find the maximum… Read More
Tag Archives: Algorithms-Dynamic Programming
Given a binary tree and a target, find the number of nodes in the minimum sub-tree with the given sum equal to the target which… Read More
Given an array A[] of N numbers, the task is to find the length of the longest valid number that can be formed by connecting… Read More
Given an array of intervals[], the task is to find the minimum count of subintervals needed to cover a given time duration. Each interval represents… Read More
Given arrays A[] and B[] of size N, the task is to count ways to form an array of size N such that the new… Read More
Dynamic Programming (DP) is defined as a technique that solves some particular type of problems in Polynomial Time. Dynamic Programming solutions are faster than the… Read More
Given a complete graph having N nodes and N*(N-1)/2 edges and a positive integer K, the task is to find the number of ways if… Read More
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 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, the task is to find the count of maximum occurring subsequence P from S using only those characters whose indexes are… Read More
Given a number N, the task is to find the number of ways in which the integer N can be represented as a sum of… 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