Minesweeper

You are given a 2D grid representing a Minesweeper game. You need to reveal the cells of the grid according…

Count Sub Islands

You are given two 2D grids, grid1 and grid2, both representing islands, where grid1 represents the original island and grid2…

Walls and Gates

You are given a 2D grid representing a house, with rooms labeled as 'INF' for empty rooms, -1 for walls,…

Surrounded Regions

Given a 2D board containing 'X' (representing walls) and 'O' (representing open spaces), capture all regions surrounded by 'X'. A…

Number of Islands

Given a 2D grid of '1's (land) and '0's (water), count the number of islands. An island is surrounded by…

Flood Fill

Given an image represented by a 2D matrix of integers, an initial pixel, and a new color, implement the flood…