Problem Statement
一个n*n的画板上有若干个格子需要染色,
每次可以选择一个起点然后沿着上下左右任意一个方向染色,
每次染色不能经过不需要染色或者已经染过色的格子,
染色过程中也不能改变方向,求最小化染色次数。
数据保证n <= 50。
There is a white rectangular board divided into a grid of unit square cells.
Fox Ciel wants to paint some of the cells black, so that the board looks as described by the String[] target.
More precisely: for each i, j, the cell in row i, column j of the board (0-based indices) should be painted black if target[i][j] is '#', and it should remain white if target[i][j] is '.'.
Fox Ciel paints in steps.
In each step, she selects a group of white cells and paints all of them black.
She is only allowed to select a contiguous sequence of white cells in a single row or in a single column.
Return the minimal number of steps needed to color the board.