Given a directed graph and a source node and destination node, we need to find how many edges we need to reverse in order to… Read More
Category Archives: Greedy
A board of length m and width n is given, we need to break this board into m*n squares such that cost of breaking is… Read More
Given an array of size n and a number k. We must modify array K a number of times. Here modify array means in each… Read More
Given a set of n jobs where each job i has a deadline di >=1 and profit pi>=0. Only one job can be scheduled at… Read More
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