Black and White Chess Largest Connected Region

Asked at Hudson River Trading · Coding Questions · Difficulty: Medium

Given a 2D chessboard where black and white pieces are represented by the characters `'B'` and `'W'`, compute the size of the **largest connected region** of pieces of the same color. Two pieces are connected if they are adjacent horizontally or vertically. Output the area of the largest region.

Loading the problem…