Problem Statement: Given a boolean 2D matrix grid of size N x M. You have to find the number of

Continue reading# Category: Graph

## Bipartite Graph | BFS Implementation

Problem Statement: Given an adjacency list of a graph adj of V no. of vertices having 0 based index. Check

Continue reading## Bipartite Graph | DFS Implementation

Problem Statement: Given an adjacency list of a graph adj of V no. of vertices having 0 based index. Check

Continue reading## Number of Enclaves

Problem Statement: You are given an N x M binary matrix grid, where 0 represents a sea cell and 1

Continue reading## Surrounded Regions | Replace O’s with X’s

Problem Statement: Given a matrix mat of size N x M where every element is either ‘O’ or ‘X’. Replace

Continue reading## Distance of Nearest Cell having 1

Problem Statement: Given a binary grid of N*M. Find the distance of the nearest 1 in the grid for each

Continue reading## Detect Cycle in an Undirected Graph (using DFS)

Problem Statement: Given an undirected graph with V vertices and E edges, check whether it contains any cycle or not.

Continue reading## Detect Cycle in an Undirected Graph (using BFS)

Problem Statement: Given an undirected graph with V vertices and E edges, check whether it contains any cycle or not.

Continue reading## Rotten Oranges

Problem Statement: Given a grid of dimension N x M where each cell in the grid can have values 0,

Continue reading## Flood Fill Algorithm – Graphs

Problem Statement: An image is represented by a 2-D array of integers, each integer representing the pixel value of the

Continue reading