You have given a matrix of colors (Blue and Red). Return the number of button that are connected the most as well as the least connected buttons. You can traverse in all the directions, e.g. Left, Right, Up Down as well as diagonally.
Both the buttons can be of same color.
Example:
s = [['R', 'R'], ['R', 'B'], ['R', 'R'], ['R', 'B']]
return [6, 1]
Another Testcase:
s = [['R', 'R', 'B', 'B', 'R', 'B'], ['R', 'B', 'R', 'B', 'B', 'B']]
return [7, 1]