Compare Diagonal

Published by adityagupta1807 in

Create a function that returns the right diagonal of a matrix if the sum of the right diagonal is greater than or equal to the sum of the left diagonal, else returns the left diagonal.

Examples

compare_diagonals([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) ➞ [3, 5, 7]

Notes

The matrix will be a square matrix of any order.

Watch a quick demo on how Edabit works.