4 kyu
Simple Fun #209: Largest Room Area
316myjinxin2015
Description:
Task
You have been given a matrix filled with 1s
and 0s
, where 1
represents a wall, and 0
represents empty space.
Your task is to find the largest room in the given matrix, i.e. the largest area filled only with 0s
.
Input/Output
[input]
2D integer arrayrooms
A rectangular matrix filled with 1s
and 0s
.
[output]
an integer
The area of the largest room.
Example
For
rooms = [[1,1,1,1,1,1],
[1,0,1,0,0,1],
[1,0,1,0,0,1],
[1,1,1,1,1,1]]```
the output should be `4`.
For
rooms = [[1, 0],
[0, 1]]```
the output should be 1
.
Puzzles
Fundamentals
Similar Kata:
Stats:
Created | Apr 25, 2017 |
Published | Apr 25, 2017 |
Warriors Trained | 921 |
Total Skips | 215 |
Total Code Submissions | 1646 |
Total Times Completed | 316 |
JavaScript Completions | 316 |
Total Stars | 37 |
% of votes with a positive feedback rating | 95% of 83 |
Total "Very Satisfied" Votes | 75 |
Total "Somewhat Satisfied" Votes | 8 |
Total "Not Satisfied" Votes | 0 |
Total Rank Assessments | 4 |
Average Assessed Rank | 4 kyu |
Highest Assessed Rank | 4 kyu |
Lowest Assessed Rank | 5 kyu |