Skip to content

Tag Archives: Algorithms-Greedy Algorithms

You are working in Samara, Russia for a few days. Each day has a new pay per unit of work and a new cost per… Read More
Given an array arr[] of size N, the task is to find the minimum number of increment or decrement operations required at any index i… Read More
Given an array arr[] of size N, the task is to find the maximum possible sum of the array elements such that the element can… Read More
Given an array arr[] of N integers, the task is to find if the array can be divided into 2 sub-array such that the first… Read More
Given a 2D matrix tsp[][], where each row has the array of distances from that indexed city to all the other cities and -1 denotes… Read More
Given an array A[] of N integers and an integer K, the task is to select the maximum number of elements from the array whose… Read More
Given a matrix mat[][], pair of indices X and Y, the task is to find the number of moves to bring all the non-zero elements… Read More
Given a list of intervals interval[] where each interval contains two integers L and R, the task is to assign intervals to two different processors… Read More
Given an even number N, the task is to split all N powers of 2 into two sets such that the difference of their sum… Read More
Given N rods of different lengths. The task is to cut all the rods with some maximum integer height ‘h’ such that the sum of… Read More
Given an array of positive integers containing the price of stocks and transaction fee, the task is to find the maximum profit and the difference… Read More
Given an array of positive integers. The task is to choose a pair of elements from the given array such that they represent the length… Read More
Given an array of N numbers, the task is to find the maximum sum that can be obtained by adding numbers with the same number… Read More
Given an array containing N integers. The task is to find the sum of the elements of the contiguous subarray having the smallest(minimum) sum.Examples:   Input:… Read More