Largest rectangular submatrix with k difference

Entrance: Two-dimensional array NxN - Matrix - with numbers from 0 to 9.

Conclusion: The largest rectangular region, where the absolute value of the difference of numbers in the region k .

Possible input:

int k=3; const int N=5; int matrix[N][N] = {{9, 3, 8, 2, 0}, {2, 7, 6, 8, 5}, {8, 5, 7, 7, 6}, {3, 0, 4, 0, 9}, {7, 2, 0, 4, 0}}; 

Is this related to finding the largest area in the histogram problem? If he does, how can I convert this matrix to two binary matrices? And how to approach such problems?

Answer: the largest area is 8 by the next submatrix {{7, 6, 8, 6}, {5, 7, 7, 6}}

What I should do:

  • Convert matrix to binary matrix
  • Creating a binary matrix histogram
  • Calculate the largest area using the largest area in the histogram.

It is not clear how to convert the input matrix to a binary matrix.

0
algorithm matrix
Sep 22 '14 at 1:15
source share

No one has answered this question yet.

See similar questions:

fourteen
Largest rectangular sub-matrix with the same number
one
Search for elements at a distance k from the matrix

or similar:

1518
Image Processing: Enhanced Coca-Cola Can Recognition Algorithm
1067
A simple interview question got complicated: by numbers 1..100, find the missing numbers for which exactly k are absent
73
Find the largest rectangle containing only zeros in the N × N binary matrix
fourteen
Largest rectangular sub-matrix with the same number
eleven
Find the largest cuboid containing only 1 in the binary array NxNxN
3
How to find the largest squared palindrome in a matrix
2
Convert a NxN binary matrix to a null matrix using a minimum number of column row switches
one
Efficient dynamic programming of rectangular queries in a boolean matrix
one
Convert NxN binary matrix to null matrix using minimal rows and columns
one
Using binary search to find an auxiliary array with the largest sum modulo x, my solution uses iterative search.



All Articles