

Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!


Explanation : The maximum sum submatrix refers to the contiguous submatrix within the given 2D array (or matrix) where the sum of its elements is the highest among all possible submatrices.
1, 2, - 1, - 4, - 20
35
Given are N boards with a length of each given in the form of an array, and K painters, each painter takes 1 unit of time to paint 1 unit of the board. Task: Find the minimum time to paint all boards under the constraints that any painter will only paint continuous sections of boards, say board {2, 3, 4} or only board {1} or nothing but not board {2, 4, 5}.
N = 4 A = {10, 10, 10, 10} K = 2
20 Explanation : Here we can divide the boards into 2 equal-sized partitions (Painter 1 will paint boards A and A2, and Painter 2 will paint boards A3 and A4). So, each painter gets 20 units of board and the total time taken is 20.
N = 4 A = {10, 20, 30, 40} K = 2
60 Explanation : Since there are only 2 painters, divide the first 3 boards to painter 1 (A1, A2, and A3) with time = 60, and the last board to painter 2 (A4) with time = 40. Therefore, the total time taken = 60, which is the minimum possible.