Given an array of n distinct elements, find the minimum number of swaps required to sort the array. Examples: Input: {4, 3, 2, 1} Output:… Read More

# Category Archives: Graph

Given a initial number x and two operations which are given below: Multiply number by 2. Subtract 1 from the number. The task is to… Read More

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

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

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 a binary digit number if its digits are binary. For example, 102 is not a binary digit number and 101… Read More

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

I recently got interviewed for MakeMyTrip for the Software Engineer full time position. There were in a total of 5 rounds. First Round (Online Coding… Read More

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

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

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

there were 5 rounds of interview with 3 technical round, 1 director round and 1 HR round. Round 1 (Technical) 1st question :- Minimum number… Read More

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

Direct I came for Full Time recruitment for Applications Engineer, Operations Engineer and Platform Engineer in our campus. Round 1 Online test on Codechef contains… Read More

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