Problem Description
Given a matrix A of size N x M. You want to maximize the minimum of the matrix A by performing the following operation B number of times.
Return the minimum value of the matrix after performing the operation such that minimum of the matrix is maximized.
1 <= N x M <= 2 * 105
-108 <= A[i][j] <= 108
1 <= B <= 109
1 <= C <= M
First argument is a 2D array A of size N x M.
Second argument is an integer B.
Third argument is an integer C.
Return an integer denoting the minimum value of matrix after performing the operation.
Input 1:
A = [ [2, -1, 5] [-2, 3, -2] ] B = 4 C = 2
Input 2:
A = [ [2, 2] [2, 1] [1, 2] ] B = 1 C = 1
Output 1:
0
Output 2:
1
Explanation 1:
Select submatrix [-2, 3] and increase elements by 2 twice. Matrix will be after doing two operation: [ [2, -1, 5] [2, 7, -2] ] Select submatrix [7, -2] and increase elements by 2. Matrix will be: [ [2, -1, 5] [2, 9, 0] ] Select submatrix [2, -1] and increase elements by 2. Matrix will be: [ [4, 1, 5] [2, 9, 0] ] All 4 operations are done, minimum element is 0.
Explanation 2:
Minimum element will be 1.
NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a question? Checkout Sample Codes for more details.