Largest connected region
Your task
Given an m x n grid of integers, a region is a maximal group of 4-directionally connected cells that all share the same value. Return the size (number of cells) of the largest region in the grid. The grid has at least one cell. Values can be any integers including negatives.
Examples
largest_region(grid: list[list[int]]) -> intExample 1
Input
largest_region([[1, 1, 2], [1, 2, 2], [3, 3, 2]])Output
4