The method must take in 3 parameters: Matrix, region number, max number. The method should take max number and check if values in the matrix are greater than the max number. If so, the function checks if nearby elements are also greater than said max number. If the number of elements that fit this description are greater than or equal to the region number, they turn into 1, otherwise, it turns into 0.

The output should be a matrix full of 1's and 0's

Do not wrap around matrix edges. Corner neighbors are not sufficient for island continuity

Example:

Island size is 4, Max number is 6

1,2,3,1,2,2
5,4,9,6,2,2
6,6,9,2,2,7
7,2,2,2,7,8
3,2,7,6,8,8
2,2,1,1,1,2

Output:
0,0,0,0,0,0
0,0,1,1,0,0
1,1,1,0,0,1
1,0,0,0,1,1
0,0,1,1,1,1
0,0,0,0,0,0

Example:

Island size is 3, Max number is 5
5,1,1
6,7,7
1,1,1

Output:
1,0,0
1,1,1
0,0,0
Academic Honesty!
It is not our intention to break the school's academic policy. Posted solutions are meant to be used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly complete the form. Please provide a valid email address and we will get back to you within 24 hours. Payment is through PayPal, Buy me a Coffee or Cryptocurrency. We are a nonprofit organization however we need funds to keep this organization operating and to be able to complete our research and development projects.