I have had a task given to me which requires me to ask user for a size of 2D Array, we need to create a 2D array with the specified size, so if user opted for 8 as the size, we make an 8x8 array and we randomly fill it with either 'X' or 'O'.
Now the main task is to find number of groups in that 2D array.
4 or more 'X' which are connected (horizontally OR vertically NOT diagonally) are what makes a group.
For example, there are 3 groups on the following photo:
My question is if there is (there probably is) an algorithm that deals with similar problems, so please do provide reading material if you have any.
