I have a 2D array like:
my_array = [[3, 3, 0, 0, 0],
[3, 3, 0, 0, 0],
[0, 0, 0, 1, 1],
[0, 0, 0, 1, 1],
[0, 0, 0, 1, 1],
[0, 0, 0, 0, 0,]]
I would like to check the starts and ends of a portion of the array with the same values (different from 0). So in the example above I would like to get something like:
result = [(0,0,1,1), (2,3,4,5)]
Where each tuple on the list is (i_start, j_start, i_end, j_end)
Is there any function that achieves something similar?