# Data Structure Questions and Answers-Maximum Sum Rectangle in a 2D Matrix

## Click on any option to know the CORRECT ANSWERS

 Question 1
Given a 2D matri, x find a submatrix that has the maximum sum. Which of the following methods can be used to solve this problem?
 A Brute force B Recursion C Dynamic programming D All of the mentioned

Question 1 Explanation:
All of the mentioned methods can be used to solve the above problem.

 Question 2
In which of the following cases, the maximum sum rectangle is the 2D matrix itself?
 A When all the elements are negative B When all the elements are positive C When some elements are positive and some negative D None of the mentioned

Question 2 Explanation:
When all the elements of a matrix are positive, the maximum sum rectangle is the 2D matrix itself.

 Question 3
In which of the following cases, the maximum sum rectangle can be a 1 x 1 matrix containing the largest element?
 A When the matrix is a 1×1 matrix B When all the elements of a matrix are zero C When all the elements of the matrix are negative D All of the mentioned

Question 3 Explanation:
In all of the above cases, the maximum sum rectangle is a 1×1 matrix containing the largest element.

For the case, when all elements are zero, any submatrix can be chosen and 1×1 submatrix is a possible solution.

 Question 4
Consider a matrix in which all the elements are non-zero(at least one positive and at least one negative element). In this case, the sum of the elements of the maximum sum rectangle cannot be zero.
 A True B False

Question 4 Explanation:
If a matrix contains all non-zero elements with at least one positive and at least on negative element, then the sum of elements of the maximum sum rectangle cannot be zero.

 Question 5
Consider the 2×3 matrix {{1, 2, 3}, {1, 2, 3}}. What is the sum of elements of the maximum sum rectangle?
 A 3 B 6 C 12 D 18