[First release exclusive] HUAWEI OD machine test - happy Xiaoxiaole (GO language problem solving)

insert image description hereRecently updated blog

Solution to this article: Happy Xiaoxiaole

topic

Given a two-dimensional matrix with N rows and M columns, the value of each position in the matrix is ​​0 or 1. An example of the matrix is:

1 1 0 0
0 0 0 1
0 0 1 1
1 1 1 1

Now it is necessary to invert all 1s in the matrix to 0, the rules are as follows:

  1. When a 1 is clicked, the 1 is reversed to 0, and the 1s in the adjacent up, down, left, right, and upper left, lower left, upper right, and lower right directions (if there are 1) will be automatically inverted for

おすすめ

転載: blog.csdn.net/hihell/article/details/130501774