4 kyu

Simple Fun #209: Largest Room Area

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 array rooms

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

Stats:

CreatedApr 25, 2017
PublishedApr 25, 2017
Warriors Trained921
Total Skips215
Total Code Submissions1646
Total Times Completed316
JavaScript Completions316
Total Stars37
% of votes with a positive feedback rating95% of 83
Total "Very Satisfied" Votes75
Total "Somewhat Satisfied" Votes8
Total "Not Satisfied" Votes0
Total Rank Assessments4
Average Assessed Rank
4 kyu
Highest Assessed Rank
4 kyu
Lowest Assessed Rank
5 kyu
Ad
Contributors
  • myjinxin2015 Avatar
  • Voile Avatar
Ad