Back
Close
  • 33

Learning Opportunities

This puzzle can be solved using the following concepts. Practice using these concepts and improve your skills.

Statement

 Goal

Given a width x height binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area.
Input
Line 1: Two separated integers width and height
Next height lines: width separated integers (Either 1 or 0)
Output
An integer of the largest rectangle containing only 1's area
Output 0 if there is no rectangle that only contain 1's
Constraints
0 < width, height < 51
Example
Input
5 4
1 0 1 0 0
1 0 1 1 1
1 1 1 1 1
1 0 0 1 0
Output
6

A higher resolution is required to access the IDE