로딩
요청 처리 중입니다...

JAVA_LeetCode 2500_Delete Greatest Value in Each Row

 JAVA_LeetCode 2500_Delete Greatest Value in Each Row

JAVA_LeetCode 2500_Delete Greatest Value in Each Row 풀이 class Solution { public int deleteGreatestValue(int[][] grid) { // 정렬 후 각 행마다 최대값을 찾아 더해준다. int colLen = grid[0].length, rowLen = grid.length, res = 0, max = 0; for(int[] arr : grid) Arrays.sort(arr); for(int col = 0; col < colLen; col++){ max = 0; for(int row = 0; row < rowLen; row++) max = Math.max(max, grid[row][col]); res += max; } return res; } } * 출처 https://leetcode.com/problems/delete-greatest-value-in-each-row...

# JAVA # JAVA_DeleteGreatestValueinEachRow # JAVA_LeetCode2500 # JAVA_LeetCode2500_DeleteGreatestValueinEachRow # LeetCode2500_DeleteGreatestValueinEachRow