I have a 2-dimensional array where I need to convert the first diagonal numbers to zero. For example, I need to convert the following:
[ 1 2 3 ]
[ 5 9 5 ]
[ 3 2 1 ]
To this, meaning the diagonal 1 9 1 is now 0 0 0:
[ 0 2 3 ]
[ 5 0 5 ]
[ 3 2 0 ]
How can I efficiently do this in C#?
All you’re doing is setting the points in the grid to be zero when X and Y are equal. (1,1), (2,2), and so on;