Redian新闻
>
Smallest Rectangle Enclosing Black Pixels
avatar
Smallest Rectangle Enclosing Black Pixels# JobHunting - 待字闺中
h*y
1
An image is represented by a binary matrix with 0 as a white pixel and 1 as
a black pixel. The black pixels are connected, i.e., there is only one black
region. Pixels are connected horizontally and vertically. Given the
location (x, y) of one of the black pixels, return the area of the smallest
(axis-aligned) rectangle that encloses all black pixels.
For example, given the following image:
[
"0010",
"0110",
"0100"
]
and x = 0, y = 2,
Return 6.
这个题目是什么意思? 看不明白,是说能够覆盖所有黑色点的最小的矩形嘛?那x,y不
同有啥不同吗? 题目说x,y一定是黑色的中间的一个啊。
avatar
o*h
2
就是给你任何一个为1的点。不影响结果。算出来都一样。

as
black
smallest

【在 h*****y 的大作中提到】
: An image is represented by a binary matrix with 0 as a white pixel and 1 as
: a black pixel. The black pixels are connected, i.e., there is only one black
: region. Pixels are connected horizontally and vertically. Given the
: location (x, y) of one of the black pixels, return the area of the smallest
: (axis-aligned) rectangle that encloses all black pixels.
: For example, given the following image:
: [
: "0010",
: "0110",
: "0100"

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。