classSolution { publicintdeleteGreatestValue(int[][] grid) { for (int[] g : grid) { Arrays.sort(g); } intans=0, m = grid.length, n = grid[0].length; for (intj=0; j < n; ++j) { intmax= -1; for (inti=0; i < m; ++i) { if (grid[i][j] > max) max = grid[i][j]; } ans += max; } return ans; } }