UVA 10189- Minesweeper

Minesweeper UVA Problem

I am having trouble understanding or solving the matrices/2D Array questions. I cam across this question on Competetive Programming book.

LINK- https://onlinejudge.org/index.php?option=onlinejudge&Itemid=8&page=show_problem&problem=1130

I would be really grateful if someone can help me through this. A tutorial for this in PYTHON would be really appreciated.

Thank you!

I think you should use dynamic programming to solve it.