# Tag Archives: BFS

## Count of prime factors of N to be added at each step to convert N to M

Given two integers N and M, the task is to find out minimum number of operations required to convert N to M. Each operation involves… Read More »

## Minimum nodes to be colored in a Graph such that every node has a colored neighbour

Given a graph G with V nodes and E edges, the task is to colour no more than floor(V/2) nodes such that every node has… Read More »

## Minimum clicks to convert string X to Y

Given a starting string X of 3 characters, finishing string Y of 3 characters and an array of forbidden strings. The task is to find… Read More »

## Min steps to convert N-digit prime number into another by replacing a digit in each step

Given two N-digit prime numbers A and B, the task is to find the minimum number of steps taken to convert A to B. Condition… Read More »

## Length of longest connected 1’s in a Binary Grid

Given a grid of size N*M consists of 0 and 1 only, the task is to find the length of longest connected 1s in the… Read More »

## Check if it is possible to reach to the index with value K when start index is given

Given an array arr[] of N positive integers and two positive integers S and K, the task is to reach the position of the array… Read More »

## Print all shortest paths between given source and destination in an undirected graph

Given an undirected and unweighted graph and two nodes as source and destination, the task is to print all the paths of the shortest length… Read More »

## Minimum number of reversals to reach node 0 from every other node

Given a Directed Graph with N vertices value from 0 to N – 1 and N – 1 Edges, the task is to count the… Read More »

## Check if the end of the Array can be reached from a given position

Given an array arr[] of N positive integers and a number S, the task is to reach the end of the array from index S.… Read More »

## Find if there is a path between two vertices in an undirected graph

Given an undirected graph with N vertices and E edges and two vertices (U, V) from the graph, the task is to detect if a… Read More »

## Check if the given permutation is a valid BFS of a given Tree

Given a tree with N nodes numbered from 1 to N and an permutation array of numbers from 1 to N. Check if it is… Read More »

## Minimum circular rotations to obtain a given numeric string by avoiding a set of given strings

Given a numeric string target of length N and a set of numeric strings blocked, each of length N, the task is to find the… Read More »

## What is a Webcrawler and where is it used?

Web Crawler is a bot that downloads the content from the internet and indexes it. The main purpose of this bot is to learn about… Read More »

## Find integral points with minimum distance from given set of integers using BFS

Given an integer array A[] of length N and an integer K. The task is to find K distinct integral points which are not present… Read More »

## Minimum possible modifications in the matrix to reach destination

Given a matrix of size N x M consisting of integers 1, 2, 3 and 4. Each value represents the possible movement from that cell:… Read More »