Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use a data structure to store all values of each diagonal.
How to index the data structure with the id of the diagonal?
All cells in the same diagonal (i,j) have the same difference so we can get the diagonal of a cell using the difference i-j.