Skip to content

Tag Archives: BFS

Given an undirected graph with V vertices and E edges and a node X, The task is to find the level of node X in… Read More
Given a matrix arr[][] of size M * N, where arr[i][j] represents the height of the cell (row, col). The task is to find a… Read More
Given an array arr[] of size N, the task is to find the minimum number of jumps to reach the last index of the array… Read More
Given a 2D matrix, where ‘*’ represents an obstacle and the rest all represent coins in the grid. It is also given that you are… Read More
Given an undirected graph consisting of N nodes labeled from 0 to N – 1, which are represented by a 2D array arr[][], where arr[i]… Read More
Given a graph and the list of neighbours for each node in an array graph[] of size N, where graph[i] contains a list of neighbor… Read More
Given an array nums[] of size N and a starting index K. In one move from index i we can move to any other index… Read More
Given a 2D binary matrix of size N * M, where 0 represents an empty space while 1 represents a wall you cannot walk through.… Read More
To understand this let’s take a binary tree Binary tree If we conduct BFS in this tree: In level 0 there is one node in… Read More
Given a binary tree and a node start that is initially infected. For every second, neighbours of an infected node get infected. The task is… Read More
Generally, when we come across a graph problem, we might need to traverse the structure of the given graph or tree to find our solution… Read More
Given a matrix mat[][] of size N*M and the destination (x, y) to be reached from (0, 0), the task is to find if you… Read More
Given a directed graph with N nodes and M connections shown in the matrix mat[] where each element is of the form {xi, yi} denoting… Read More
Given two integers N and X, the task is to convert 1 to N using minimum operations of any of the following operations: Change a… Read More
Geek is in a maze of size N * M. Each cell in the maze is made of either ‘.’ or ‘#’. An empty cell… Read More

Start Your Coding Journey Now!