【在 l*******r 的大作中提到】 : Given an N-by-N array of black (1) and white (0) pixels, find the largest : conti : guous subarray that consists of entirely black pixels. In the example below : the : re is a 4-by-4 subarray. : 1 0 1 1 1 0 0 0 : 0 0 0 1 0 1 0 0 : 0 0 1 1 1 0 0 0 : 0 0 1 1 1 0 1 0 : 0 0 1 1 1 1 1 1
One O(n^2) solution to this would be similar to the question that find the max sum sub-matrix.
below
【在 l*******r 的大作中提到】 : Given an N-by-N array of black (1) and white (0) pixels, find the largest : conti : guous subarray that consists of entirely black pixels. In the example below : the : re is a 4-by-4 subarray. : 1 0 1 1 1 0 0 0 : 0 0 0 1 0 1 0 0 : 0 0 1 1 1 0 0 0 : 0 0 1 1 1 0 1 0 : 0 0 1 1 1 1 1 1
【在 g*******y 的大作中提到】 : that's not a correct O(N^2) solution. : My own opinion: forget about DP,think about histogram problem...
a*e
63 楼
Yeah, it's O(n^3). krone's link provides a nice O(n^2) solution. Could you please elaborate your histogram method in more detail...
【在 g*******y 的大作中提到】 : that's not a correct O(N^2) solution. : My own opinion: forget about DP,think about histogram problem...
g*y
64 楼
histogram问题在那个link里面也有的~
【在 a*****e 的大作中提到】 : Yeah, it's O(n^3). : krone's link provides a nice O(n^2) solution. : Could you please elaborate your histogram method in more detail...