sorry no time to give a complete solution. But you can solve it by scan from 1,1 to m,n.
then scan back from n,m to 1,1
data strucuture: matrix for each cell's bomb number
This should be the right solutions
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.