# Category Archives: Greedy

Given an array arr[] and an integer K, the task is to find the minimum number of operations to make all the elements of the… Read More
Given an array, arr[] of M integers, where the ith element represents the time after which the ith bomb will blast after dropping it, and… Read More
Given a string S and its length N (provided N > 0). The task is to find the minimum distance between same repeating characters, if… Read More
Given an array arr[] consisting of N integers, the task is to split the array into the minimum number of disjoint groups, such that differences… Read More
Rahul and Ankit are the only two waiters in the Royal Restaurant. Today, the restaurant received N orders. The amount of tips may differ when… Read More
Consider a long alley with N doors on one side. All the doors are closed initially. You move to and fro in the alley changing… Read More
Given two positive integers N and K, and an integer X ( initially 1 ), the task is to find the minimum value of X… Read More
Given an array arr[] consisting of N pairs and a positive integer K, the task is to select the minimum number of pairs such that… Read More
Given an array arr[] consisting of N integers, the task is to make all array elements equal by replacing the leftmost largest element of the… Read More
Given an array arr[] consisting of N positive integers and some elements as -1, the task is to find the smallest number, say K, such… Read More
Given two positive integers X and Y and an array arr[] consisting of N positive integers such that arr[i] represents the height of the ith… Read More
Given an integer array, arr[] of size N and an integer X. The task is to sort the array in increasing order in a minimum… Read More
Given an array arr[] consisting of N integers and a positive integer K, the task is to find the last element present in the array… Read More
Given an array arr[] of size N and an integer K, the task is to find the maximum possible value of D, such that every… Read More
Given an array, arr[] of size N and an integer T. The task is to find for each index the minimum number of indices that… Read More