A hotel manager has to process N advance bookings of rooms for the next season. His hotel has K rooms. Bookings contain an arrival date… Read More

# Category Archives: Greedy

Given an array a, your task is to convert it into a non-increasing form such that we can either increment or decrement the array value… Read More

Given an array, the task is to compute the sum of all possible maximum area rectangles which can be formed from the array elements. Also,… Read More

Consider the given array arr[], we need to find if we can sort array with the given operation. The operation is 1. We have to select… Read More

There are n student groups at the school. On each day in school, there are m time slots. A student group may or may not… Read More

Given an array and k, we need to find the minimum operations needed to make GCD of the array equal or multiple of k. Here… Read More

Given two arrays of same size, we need to convert the first array into another with minimum operations. In an operation, we can either increment… Read More

Given an array and a value k. We have to find the maximum number of equal elements possible for the array so that we can… Read More

Given an array of even number of elements, form groups of 2 using these array elements such that the difference between the group with the… Read More

Given an array a, we have to find the minimum product possible with the subset of elements present in the array. The minimum product can… Read More

Given an array a, we have to find maximum product possible with the subset of elements present in the array. The maximum product can be… Read More

There are n cores of processor. Each core can process a task at a time. Different cores can process different tasks simultaneously without affecting others.… Read More

Given a number n, the task is to find the largest perfect cube that can be formed by deleting minimum digits(possibly 0) from the number. X… Read More

Given an array, we need to find the maximum sum of absolute difference of any permutation of the given array.Examples: Input : { 1, 2,… Read More