You are given a 2D list nums. Your score begins at 0.
In every round, you must select the largest value from each row and remove those values from the matrix.
Among all removed values in that round, find the greatest one and add it to your score.
Continue performing these rounds until all values are removed from the matrix.
Return the total score obtained after all rounds.
Input: nums = [[10,3,8],[4,6,5],[9,1,2]]
Output: 22
Explanation:
Round 1 Removed: 10, 6, 9 → max is 10 → score = 10 Round 2 Removed: 8, 5, 2 → max is 8 → score = 10 + 8 = 18 Round 3 Removed: 3, 4, 1 → max is 4 → score = 18 + 4 = 22
Input: nums = [[5,5],[5,5]]
Output: 10
Explanation:
Round 1: removed values are 5,5 → max = 5 Round 2: removed values are 5,5 → max = 5
Accepted:
Submission: