Company: Salesforce SDE_23april
Difficulty: medium
Given a Salesforce dashboard with n rows and m columns of opportunity data values, the following operation can be performed: Select a non-empty row of the dashboard. Remove an opportunity value either from the start or end of the selected row. If the first (starting) opportunity value of a row is removed, the next value in that row becomes the starting value. A similar logic applies when removing the last value of the row. Determine the maximum possible sum of opportunity values being removed after performing exactly k operations. Note that you need maximize the sum of removed opportunity values not the remaining one's in the dashboard. Note: The sum of removed opportunity values is to be returned rather than the sum of the remaining opportunity values. Example Consider n = 2, m = 3, k = 3 and dashboard = [[3, 7, 2], [4, 1, 5]]. The given dashboard is as follows: [ 3 7 2 ] [ 4 1 5 ] The following sequence of removal is optimal: Remove the first opportunity value from the first row, i.e