Let's say I have a 2d array 100x100 in size, each cell in that array has a number from 1 to 50 randomly.
How do I find the biggest subarray in a rectangle size in that array that has only n different numbers?
Small example:
array: 1 2 3 3 3 2 2
7 4 3 3 4 9 8
1 2 3 3 3 4 2
7 6 1 9 9 4 2
In this case the biggest sub rectangle with only 1 number allowed would be
3 3
3 3
With 2 numbers allowed it would be
3 3 3
3 3 4
3 3 3
Does something for this exist?
Aucun commentaire:
Enregistrer un commentaire