Problem: You are given a table with rows and columns. Each cell is colored with white or black. Considering the shapes created by black cells, what is the maximum border of these shapes? Border of a shape means the maximum number of consecutive black cells in any row or column without any white cell in between.
A shape is a set of connected cells. Two cells are connected if they share an edge. Note that no shape has a hole in it.
Input format:
The first line contains denoting the number of test cases. The first line of each test case contains integers denoting the number of rows and columns of the matrix. Here, '#' represents a black cell and '.' represents a white cell. Each of the next lines contains integers. Output format
Print the maximum border of the shapes.
I tried using loops but was unable to obtain the desired output.
source https://stackoverflow.com/questions/74747516/how-to-proceed-in-this-question-using-python
Comments
Post a Comment