Tap here to switch tabs
Problem
Submissions

Problem: Delete Greatest Value in Each Row

med
30 min
Try to solve the Delete Greatest Value in Each Row problem.

Statement

You are given an m $ imes$ n matrix grid consisting of positive integers.

Perform the following process repeatedly until grid becomes empty:

  1. Delete the maximum value from each row. If a row contains multiple copies of the maximum value, delete any one of them.

  2. Identify the greatest value among all the elements removed across every row in the current step.

  3. Add this value to a running total.

Return the final sum obtained after all elements are removed from grid.

Constraints:

  • m ==== grid.length

  • n ==== grid[i].length

  • 1≤1 \leq m, n ≤50\leq 50

  • 1≤1 \leq grid[i][j] ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Delete Greatest Value in Each Row

med
30 min
Try to solve the Delete Greatest Value in Each Row problem.

Statement

You are given an m $ imes$ n matrix grid consisting of positive integers.

Perform the following process repeatedly until grid becomes empty:

  1. Delete the maximum value from each row. If a row contains multiple copies of the maximum value, delete any one of them.

  2. Identify the greatest value among all the elements removed across every row in the current step.

  3. Add this value to a running total.

Return the final sum obtained after all elements are removed from grid.

Constraints:

  • m ==== grid.length

  • n ==== grid[i].length

  • 1≤1 \leq m, n ≤50\leq 50

  • 1≤1 \leq grid[i][j] ≤100\leq 100