Recently updated blog
- Huawei od 2023 | What is Huawei od, od salary, od machine test questions list
- A complete collection of Huawei OD machine test questions, using Python to solve Huawei machine test questions | Machine Test Collection
- [Huawei OD machine test] full process analysis + experience sharing, question type sharing, cheating prevention guide
- Huawei od machine test, exclusive compilation of practical skills of those who have participated in the machine test
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:
- 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