Basically this is a homework assignment and if you answer my question, I prefer to get a lead to the answer rather than the code and the answer itself.
This has to be a recursive method, which, in a given two dimensional boolean array, has to return the number of true zones in the array - the number of rows and cols in the array will always be the same.
True zone is defined when there's at least one true element, if it has a neighboring other element which is also true, they still count as 1. Elements that are diagonal are not considered neighbors.
For example, in this matrix when 1 stands as true and 0 stands as false, there are 3 true zones - the two cells on the left side, the three cells on the right side, and the one cell on the last row, by himself.
1 0 0 1
1 0 1 1
0 1 0 0
I don't know how to approach this problem recursively, in a simple iteration it'd be quite simple I assume, but it seems impossible to check the array using a method that's calling itself.
Anyone has a lead?