##
Maximum edges that can be added to DAG so that is remains DAG
November 10, 2016

A DAG is given to us, we need to find maximum number of edges that can be added to this DAG, after which new graph… Read More »

November 10, 2016

A DAG is given to us, we need to find maximum number of edges that can be added to this DAG, after which new graph… Read More »

November 6, 2016

Given an array containing one digit numbers only, assuming we are standing at first index, we need to reach to end of array using minimum… Read More »

A decimal number is called binary digit number if its digits are binary. For example, 102 is not a binary digit number and 101 is.… Read More »

November 4, 2016

Given the number of vertices and the degree of each vertex where vertex numbers are 1, 2, 3,…n. The task is to identify whether it… Read More »

October 17, 2016

We are given a map of cities connected with each other via cable lines such that there is no cycle between any two cities. We… Read More »

October 13, 2016

Given an undirected graph, which has tree characteristics. It is possible to choose any node as root, the task is to find those nodes only… Read More »

October 8, 2016

Given an undirected graph and a set of vertices, find all reachable nodes from every vertex present in the given set. Consider below undirected graph… Read More »

September 8, 2016

Given two integers ‘n’ and ‘m’, find all the stepping numbers in range [n, m]. A number is called stepping number if all adjacent digits… Read More »

September 2, 2016

Cloning of a LinkedList and a Binary Tree with random pointers has already been discussed. The idea behind cloning a graph is pretty much similar.… Read More »

August 28, 2016

Given a Weighted Directed Acyclic Graph (DAG) and a source vertex in it, find the longest distances from source vertex to all other vertices in… Read More »

August 26, 2016

Given a matrix that is filled with ‘O’, ‘G’, and ‘W’ where ‘O’ represents open space, ‘G’ represents guards and ‘W’ represents walls in a… Read More »

August 24, 2016

Given a Directed Acyclic Graph (DAG), find Topological Sort of the graph. Topological sorting for Directed Acyclic Graph (DAG) is a linear ordering of vertices… Read More »

July 5, 2016

A vertex cover of an undirected graph is a subset of its vertices such that for every edge (u, v) of the graph, either ‘u’… Read More »

June 27, 2016

Given a boolean 2D matrix, find the number of islands. A group of connected 1s forms an island. For example, the below matrix contains 5… Read More »

June 15, 2016

Given a tree (not necessarily a binary tree) and a number of queries such that every query takes two nodes of tree as parameters. For… Read More »