Is "diagonal" not a line in two ways in a rectangle? One way is from left top to right down. Another way is from right top to left down. Or I understand the diagonal in matrix wrongly.. Then just ignore this issue.
If my guess is right, i would give a suggestion for an answer (using clumsy indexing way, not so clever):
Is "diagonal" not a line in two ways in a rectangle? One way is from left top to right down. Another way is from right top to left down. Or I understand the diagonal in matrix wrongly.. Then just ignore this issue.
If my guess is right, i would give a suggestion for an answer (using clumsy indexing way, not so clever):
output is: