# Tag Archives: DFS

## Number of pair of positions in matrix which are not accessible

Given a positive integer N. Consider a matrix of N X N. No cell can be accessible from any other cell, except the given pair… Read More »

## Maximum product of two non-intersecting paths in a tree

Given an undirected connected tree with N nodes (and N-1 edges), we need to find two paths in this tree such that they are non-intersecting… Read More »

## Maximum edge removal from tree to make even forest

Given an undirected tree which has even number of vertices, we need to remove the maximum number of edges from this tree such that each… Read More »

## Number of decisions to reach destination

Given a grid which consists of 4 types of characters : ‘B’ ‘.’ ‘S’ and ‘D’. We need to reach D starting from S, at… Read More »

## Delete Edge to minimize subtree sum difference

Given an undirected tree whose each node is associated with a weight. We need to delete an edge in such a way that difference between… Read More »

## Find length of the largest region in Boolean Matrix

Consider a matrix with rows and columns, where each cell contains either a ‘0’ or a ‘1’ and any cell containing a 1 is called… Read More »

## Dinic’s algorithm for Maximum Flow

Problem Statement : Given a graph which represents a flow network where every edge has a capacity. Also given two vertices source ‘s’ and sink… Read More »

## Boggle | Set 2 (Using Trie)

Given a dictionary, a method to do a lookup in the dictionary and a M x N board where every cell has one character. Find… Read More »

## Convert a tree to forest of even nodes

Given a tree of n even nodes. The task is to find the maximum number of edges to be removed from the given tree to… Read More »

## Find if an array of strings can be chained to form a circle | Set 2

Given an array of strings, find if the given strings can be chained to form a circle. A string X can be put before another… Read More »

## MakeMyTrip Interview Experience | Set 13 (On-Campus for Full Time)

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 »

## Longest path between any pair of vertices

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 »

## Stepping Numbers

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 »

## Directi Interview Experience | Set 14 (On-Campus)

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 »

## Flatten a multi-level linked list | Set 2 (Depth wise)

We have discussed flattening of a multi-level linked list where nodes have two pointers down and next. In the previous post, we flattened the linked… Read More »