## BFS for Disconnected Graph

In previous post, BFS only with a particular vertex is performed i.e. it is assumed that all vertices are reachable from the starting vertex. But… Read More »

## Best First Search (Informed Search)

Prerequisites : BFS, DFS In BFS and DFS, when we are at a node, we can consider any of the adjacent as next node. So… Read More »

## 0-1 BFS (Shortest Path in a Binary Weight Graph)

Given a graph where every edge has weight as either 0 or 1. A source vertex is also given in the graph. Find the shortest… Read More »

## Design data structures for a very large social network like Facebook or Linkedln

How would you design the data structures for a very large social network like Facebook or Linkedln? Describe how you would design an algorithm to… Read More »

## Paytm Interview Experience | Set 12 (For 1.5 Years Experienced)

I want to share my interview experience with Paytm with all of you. Round-1 [1.5 hr] Brief introduction Discussion about project why are you using… 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 »

## Longest path in an undirected tree

Given an undirected tree, we need to find the longest path of this tree where a path is defined as a sequence of nodes. Example:… Read More »

## Minimum step to reach one

Given a positive number N, we need to reach to 1 in minimum number of steps where a step is defined as converting N to… Read More »

## Find the minimum number of moves needed to move from one cell of matrix to another

Given a N X N matrix (M) filled with 1 , 0 , 2 , 3 . Find the minimum numbers of moves needed to… 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 »

## Find whether there is path between two cells in matrix

Given N X N matrix filled with 1 , 0 , 2 , 3 . Find whether there is a path possible from source to… Read More »

## Count of Binary Digit numbers smaller than N

Given a limit N, we need to find out the count of binary digit numbers which are smaller than N. Binary digit numbers are those… Read More »

## Distance of nearest cell having 1 in a binary matrix

Given a binary matrix of N x M, containing at least a value 1. The task is to find the distance of nearest 1 in… Read More »

## Minimum steps to reach target by a Knight | Set 1

Given a square chessboard of N x N size, the position of Knight and position of a target is given. We need to find out… 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 »