Search⌘ K
AI Features

Solution: Smallest Rectangle Enclosing Black Pixels

Understand how to identify the smallest axis-aligned rectangle enclosing all black pixels in a binary matrix. Learn to apply binary search on rows and columns, use helper functions, and calculate the area efficiently with runtime better than O(m×n).

Statement

You are given an m×nm \times n binary matrix image, where 0 ...