Searching for the largest area of equal elements in a matrix using BFS/DFS hybrid algorithm

Several weeks ago I was faced with the following task:
Write a program that finds the largest area of equal neighbor elements in a rectangular matrix and prints its size. Example:
table
It was hinted that Breadth first or Depth first search algorithms would be able to solve this problem. However, I was feeling way too lazy to be bothered with reading about those so I just decided to solve the problem “my way”. Continue reading “Searching for the largest area of equal elements in a matrix using BFS/DFS hybrid algorithm”