Skip to content

Tag Archives: BFS

Given a matrix of size (n*m) and a point ‘p‘ (x, y). The matrix is given in the form of 0‘s and 1‘s. In one… Read More
Given an N x N matrix of positive integers. The task is to find the shortest path from the first cell of the matrix to… Read More
Geek’s village is represented by a 2-D matrix of characters of size n*m, where H – Represents a houseW – Represents a well. – Represents… Read More
Given a binary tree consisting of N nodes. Find the path between the node having the lowest value to the node having the highest value.… Read More
Given a 2-D matrix of characters of size n*m, where H – Represents a house, W – Represents a well, O – Represents an open… Read More
Given a matrix of dimension M * N filled with values 0 (Cell that can be visited), 1 (Starting point), and 2 (Cell that cannot… Read More
Given a matrix A[][] of size N * M columns each element consists of either 0 representing free space and 1 representing wall. In one… Read More
Given a binary tree with positive values of nodes, find the minimum number of nodes that need to be removed to transform it into a… Read More
Given array A[][2] of size M, form a new array B[] of size N, for every i from 1 to M we know BA[i][0] <… Read More
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