Given a 2D array A with n rows and m columns, and two integers x and y, calculate the sum of the elements on the two diagonals that pass through the element at row x and column y (Ax,y).
Input: Input:
3 4 2 2
1 -2 3 2
4 -5 9 0
3 3 2 -2
Output:
4
Note: 1+3+−5+3+2=4
1 -2 3 2
4 -5 9 0
3 3 2 -2
Pascal's triangle | |
Column sum | |
Appearance | |
Diagonal sum | |
Point coverage | |
Swap operation | |
Spiral matrix | |
Word search | |
Matrix rotation | |
Matrix Zigzag |