Given a integer matrix of odd dimensions (3 * 3, 5 * 5). then the task is to find the sum of the middle row & column elements.
Input : 2 5 7 3 7 2 5 6 9 Output : Sum of middle row = 12 Sum of middle column = 18 Input : 1 3 5 6 7 3 5 3 2 1 1 2 3 4 5 7 9 2 1 6 9 1 5 3 2 Output : Sum of middle row = 15 Sum of middle column = 18
Sum of middle row = 12 Sum of middle column = 18
Time Complexity: O(n)
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Product of middle row and column in an odd square matrix
- Find trace of matrix formed by adding Row-major and Column-major order of same matrix
- Check if a given matrix can be converted to another given matrix by row and column exchanges
- Find sum of all elements in a matrix except the elements in row and/or column of given cell?
- Sum of matrix in which each element is absolute difference of its row and column numbers
- Sum of matrix element where each elements is integer division of row and column
- Program to find the Sum of each Row and each Column of a Matrix
- Filling diagonal to make the sum of every row, column and diagonal equal of 3x3 matrix
- Find a Square Matrix such that sum of elements in every row and column is K
- Maximum sum of a Matrix where each value is from a unique row and column
- Maximum sum of any submatrix of a Matrix which is sorted row-wise and column-wise
- Construct a Binary Matrix whose sum of each row and column is a Prime Number
- Print all elements in sorted order from row and column wise sorted matrix
- Given a Boolean Matrix, find k such that all elements in k'th row are 0 and k'th column are 1.
- Count Negative Numbers in a Column-Wise and Row-Wise Sorted Matrix
- Count zeros in a row wise and column wise sorted matrix
- Check if sums of i-th row and i-th column are same in matrix
- Minimum operations required to make each row and column of matrix equals
- Sort the matrix row-wise and column-wise
- Minimum element of each row and each column in a matrix
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : vt_m