Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

b) Consider a grid of integers, represented by a two-dimensional list. Write the

ID: 3904230 • Letter: B

Question

b) Consider a grid of integers, represented by a two-dimensional list. Write the function max_diagonal streak, which number along the upper left to lower right diagonal. returns the length of the longest streak of the same For example, consider the grid below, generated in the fashion L [8, 5, 3, 5, 3], I-1, -1, -1, -11 with the upper left to lower right diagonal bolded. 4 8 2 54 3 6 48 75 4 6 4 74 8 A call to max_diagonal_streak(L) would return 3, because the longest streak consists of 3 successive repetitions of the number 8 along the diagonal If no numbers are ever repeated in the diagonal, then naturally O should be returned. [[int])) -) ?nt: def max-diagonal-streak(L:

Explanation / Answer

Hello Student!

Here goes the code.

Test case :

Enter the dimension of the 2D square matrix : 5
8
5
3
5
3
4
-8
2
54
3
-6
4
8
75
4
5
8
5
8
-4
6
4
7
4
8
Answer :
3

Process finished with exit code 0

Thank you. Feel free to ask anything. If you like the answer. Please upvote it. Thank you again.