so I've a algorytmical problem where i need to find the biggest area of a certain type of pixels inside a 2D matrix with following conditions:
- Each pixel can be connected either diagonally or adjacently.
- The area is considered coherent only if it is surrounded by the other type of pixel
Pixel is considered an object with 3 fields:
int x,y;
String type;
boolean visited;
The input file is something like this:
00000000
01100100
00111000
00010000
00000000
Is someone able to tell me if BFS algorithm is a viable solution or should I try a different approach?