Ivan Derevianko's Blog Feed · May 2, 2019
Loop Through The Diagonal Elements In Two Dimensional Array
0Sign in to vote or save
This site does not allow itself to be embedded. You can still read it on the original site — the toolbar below keeps your place in the directory.
If you need to only loop through the diagonal elements of the two-dimensional array you can use the following C# code (but should be more or less the same for any programming language). It calculates the diagonal index based on a simple formula and has O(n) complexity, where n = max(width, height)
Comments
Nothing yet. Say the first thing.
Sign in to join the conversation.