Matrix diagonals | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Matrix diagonals

Hi, how can I loop the diagonals of the matrix in order to find out the maximum number of consecutive diagonals with the same number? Example 1 0 0 1 0 0 1 1 0 The number is 2 consecutives diagonals in this example.

16th Sep 2019, 11:33 PM
Alejo Garat
Alejo Garat - avatar
3 Answers
+ 1
Thank you Denise!!
17th Sep 2019, 8:26 PM
Alejo Garat
Alejo Garat - avatar
+ 1
Your welcome :)
17th Sep 2019, 8:30 PM
Denise Roßberg
Denise Roßberg - avatar
0
Here is an example how to print the diagonals of a matrix (n * n). With this loops it should be possible to do your task. https://code.sololearn.com/c315mfVKqbKR/?ref=app
17th Sep 2019, 2:23 PM
Denise Roßberg
Denise Roßberg - avatar