• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
March 15, 2024 |870 Views
PROBLEM OF THE DAY : 14/03/2024 | Largest subsquare surrounded by X
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Matrix but also build up problem-solving skills.

In this problem, we are given a square matrix a of size n x n, where each cell can be either 'X' or 'O', you need to find the size of the largest square subgrid that is surrounded by 'X'.More formally you need to find the largest square within the grid where all its border cells are 'X'.

Example :

Input:
n = 2
a = [[X,X],
    [X,X]]
Output:
2
Explanation:
The largest square submatrix surrounded by X is the whole input matrix.

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/largest-subsquare-surrounded-by-x0558/1

Read More