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)
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Product of middle row and column in an odd square matrix
- Check if a given matrix can be converted to another given matrix by row and column exchanges
- Replace the middle element of matrix with sum of surrounding elements
- Find trace of matrix formed by adding Row-major and Column-major order of same matrix
- Print an N x M matrix such that each row and column has all the vowels in it
- Program to find the Sum of each Row and each Column of a Matrix
- Print matrix in zig-zag fashion from the last column
- Find column with maximum sum in a Matrix
- Maximum sum of a Matrix where each value is from a unique row and column
- Check if sums of i-th row and i-th column are same in matrix
- Minimum element of each row and each column in a matrix
- Check if the given matrix is increasing row and column wise
- Replace every matrix element with maximum of GCD of row or column
- Print matrix in snake pattern from the last column
- Given a Boolean Matrix, find k such that all elements in k'th row are 0 and k'th column are 1.
- Find a Square Matrix such that sum of elements in every row and column is K
- Construct a matrix such that union of ith row and ith column contains every element from 1 to 2N-1
- Find maximum element of each column in a matrix
- Find the original matrix when largest element in a row and a column are given
- Removing row or column wise duplicates from matrix of characters
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. 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