You are given an image, where
All black pixels in the matrix form a single connected region, where connectivity is defined by horizontal or vertical adjacency.
Given two integers x and y that represent the coordinates of one of the black pixels, write an algorithm to find the area of the smallest axis-aligned rectangle that encloses all the black pixels.
Note: Your solution must have a runtime complexity less than
.
Constraints:
image.length
image[i].length
image[i][j] is either
x
y
image[x][y]
The black pixels in the image only form one component.
You are given an image, where
All black pixels in the matrix form a single connected region, where connectivity is defined by horizontal or vertical adjacency.
Given two integers x and y that represent the coordinates of one of the black pixels, write an algorithm to find the area of the smallest axis-aligned rectangle that encloses all the black pixels.
Note: Your solution must have a runtime complexity less than
.
Constraints:
image.length
image[i].length
image[i][j] is either
x
y
image[x][y]
The black pixels in the image only form one component.