You are given a rectangular board containing m x n squares. Some squares on it are missing.
You must color the existing squares white or black, so that the number of black squares is maximized, and no two existing squares of the same color have a common side.
You are given the board as a String[] board, where the j-th character of the i-th element represents the square at row i, column j. Missing squares are denoted by '.' (dot) and existing squares are denoted by '#' (sharp).
Return a String[] in the same format, where all '#' characters are replaced with lowercase 'w' for white squares and 'b' for black squares.
If there are multiple solutions, return the one among them that comes first lexicographically.
That is, you must minimize the first string, if there are still several solutions, minimize the second
one, and so on.
|