LC: 302. Smallest Rectangle Enclosing Black Pixels - spiralgo/algorithms GitHub Wiki

302. Smallest Rectangle Enclosing Black Pixels:

The Essence:

The smallest rectangle area should correspond to a rectangle covering the left-most and the right-most points of black pixels horizontally and the top and bottom points of black pixels vertically. Therefore we should search for these boundaries.

Details:

We can use Binary Search or DFS. You can find the implementations here: https://leetcode.com/problems/smallest-rectangle-enclosing-black-pixels/