#3195

Find the Minimum Area to Cover All Ones I

medium · 78.2% accepted · 491 likes · top 89%

array · matrix

⊣ practice⊣ open on leetcode ↗

Description

You are given a 2D binary array grid. Find a rectangle with horizontal and vertical sides with the smallest area, such that all the 1's in grid lie inside this rectangle.

Return the minimum possible area of the rectangle.

Solution