2850. Minimum Moves to Spread Stones Over Grid
You are given a 0-indexed 2D integer matrix
grid
of size3 * 3
, representing the number of stones in each cell. The grid contains exactly9
stones, and there can be multiple stones in a single cell.In one move, you can move a single stone from its current cell to any other cell if the two cells share a side.
Return the minimum number of moves required to place one stone in each cell.
c++
1 |
|