# Category Archives: Greedy

We are given a matrix that contains different values in each cell. Our aim is to find the minimal set of positions in the matrix… Read More
We are given n-platform and two main running railway track for both direction. Trains which needs to stop at your station must occupy one platform… Read More
Given a list of n integers containing numbers 1-n in a shuffled way and a integer K. N people are standing in a queue to… Read More
Prerequisite: Page Replacement Algorithms In operating systems, whenever a new page is referred and not present in memory, page fault occurs and Operating System replaces… Read More
Find the minimum sum of Products of two arrays of the same size, given that k modifications are allowed on the first array. In each… Read More
We are given N jobs numbered 1 to N. For each activity, let Ti denotes the number of days required to complete the job. For… Read More
Given an array A[] of n-elements. We need to select two adjacent elements and delete the larger of them and store smaller of them to… Read More
Given n, print the maximum number of composite numbers that sum up to n. First few composite numbers are 4, 6, 8, 9, 10, 12,… Read More
Given an array of N integers. You are allowed to rearrange the elements of the array. The task is to find the maximum value of… Read More
Given a string S and an integer K. The task is to find lexicographically largest subsequence of S, say T, such that every character in… Read More
Given an array of size n that has the following specifications:  Each element in the array contains either a policeman or a thief. Each policeman… Read More
You are given a lock which is made up of n-different circular rings and each ring has 0-9 digit printed serially on it. Initially all… Read More
A greedy algorithm selects a candidate greedily (local optimum) and adds it to the current solution provided that it doesn’t corrupt the feasibility. If the… Read More
We are given N jobs, and their starting and ending times. We can do two jobs simultaneously at a particular moment. If one job ends… Read More
In a stock market, there is a product with its infinite stocks. The stock prices are given for N days, where arr[i] denotes the price… Read More