result to store the sum of maximum deleted elements.max_value to store the maximum value of the current column.
b. Iterate over each row and update max_value with the last element of the row if it is greater than the current max_value.
c. Add max_value to result.
d. Remove the last element from each row.result as the final answer.