# Category Archives: Greedy

Given an integer s and d, The task is to find the largest number with given digit sum s and the number of digits d.… Read More
How to find the smallest number with given digit sum s and number of digits d? Examples :   Input : s = 9, d = 2… Read More
Given the heights of N towers and a value of K, Either increase or decrease the height of every tower by K (only once) where… Read More
Dijkstra’s shortest path algorithm runs in O(Elog V) time when implemented with adjacency list representation (See C implementation and STL based C++ implementations for details).… Read More
Given the weights and values of N items, in the form of {value, weight} put these items in a knapsack of capacity W to get… Read More
Given n items of different weights and bins each of capacity c, assign each item to a bin such that number of total used bins… Read More
Given an array of jobs with different time requirements. There are K identical assignees available and we are also given how much time an assignee… Read More
Recently makemytrip visited our Campus and I got selected in recruitment drive.The placement drive consisted of 4 rounds. Round1: MCQ and coding round It was… Read More
Given a value of V Rs and an infinite supply of each of the denominations {1, 2, 5, 10, 20, 50, 100, 500, 1000} valued… Read More
Given a set of n strings arr[], find the smallest string that contains each string in the given set as substring. We may assume that… Read More
We have discussed the following topics on Minimum Spanning Tree.Applications of Minimum Spanning Tree Problem Kruskal’s Minimum Spanning Tree Algorithm Prim’s Minimum Spanning Tree AlgorithmIn this post,… Read More
Given an array and a number ‘x’, write a function to delete ‘x’ from the given array. We assume that array maintains two things with… Read More
Given a universe U of n elements, a collection of subsets of U say S = {S1, S2…,Sm} where every subset Si has an associated… Read More
Given n cities and distances between every pair of cities, select k cities to place warehouses (or ATMs or Cloud Server) such that the maximum… Read More
Every positive fraction can be represented as sum of unique unit fractions. A fraction is unit fraction if numerator is 1 and denominator is a… Read More