Input: arr[][] = { {1, 2, 3}, {4, 5, 6}, {7, 8, 9} }
Output: 2 4 6 8
Explanation:
(1, 5, 9) and (3, 5, 7) are diagonals of arr[][] matrix. Therefore sum of parts are:
Top = 2
Left = 4
Right = 6
Bottom = 8
Input: arr[][] = { {1, 3, 1, 5}, {2, 2, 4, 1}, {5, 0, 2, 3}, { 1, 3, 3, 5} }
Output: 4 7 4 6
Explanation:
(1, 2, 2, 5) and (5, 4, 0, 1) are diagonals of arr[][] matrix. Therefore sum of parts are:
Top = 3 + 1 = 4
Left = 2 + 5 = 7
Right = 1 + 3 = 4
Bottom = 3 + 3 = 6