Anti-Diagonal Sums
Print the sums of the N+M−1 anti-diagonals (cells sharing i+j), from the top-left corner outward.
Input: the first line has N and M; the next N lines each have M integers.
Output: N+M−1 sums.
Constraints:
- 1 ≤ N, M ≤ 100
Sample Tests
Input 1
2 2 1 2 3 4
Output 1
1 5 4
Input 2
1 3 5 6 7
Output 2
5 6 7
Discussion (opens after you solve — no spoilers before)
No comments yet.