Skip to content

Commit deb93fa

Browse files
add 2500
1 parent 78a3426 commit deb93fa

File tree

3 files changed

+47
-0
lines changed
  • paginated_contents/algorithms/3rd_thousand
  • src

3 files changed

+47
-0
lines changed

Diff for: paginated_contents/algorithms/3rd_thousand/README.md

+1
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
| 2520 | [Count the Digits That Divide a Number](https://leetcode.com/problems/count-the-digits-that-divide-a-number/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2520.java) | [:tv:](https://youtu.be/7SHHsS5kPJ8) | Easy ||
4444
| 2515 | [Shortest Distance to Target String in a Circular Array](https://leetcode.com/problems/shortest-distance-to-target-string-in-a-circular-array/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2515.java) || Easy ||
4545
| 2506 | [Count Pairs Of Similar Strings](https://leetcode.com/problems/count-pairs-of-similar-strings/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2506.java) || Easy ||
46+
| 2500 | [Delete Greatest Value in Each Row](https://leetcode.com/problems/delete-greatest-value-in-each-row/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2500.java) || Easy ||
4647
| 2496 | [Maximum Value of a String in an Array](https://leetcode.com/problems/maximum-value-of-a-string-in-an-array/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2496.java) || Easy ||
4748
| 2492 | [Minimum Score of a Path Between Two Cities](https://leetcode.com/problems/minimum-score-of-a-path-between-two-cities/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2492.java) || Medium | Union Find
4849
| 2490 | [Circular Sentence](https://leetcode.com/problems/circular-sentence/) | [Java](https://github.com/fishercoder1534/Leetcode/blob/master/src/main/java/com/fishercoder/solutions/thirdthousand/_2490.java) || Easy |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.fishercoder.solutions.thirdthousand;
2+
3+
import java.util.Arrays;
4+
5+
public class _2500 {
6+
public static class Solution1 {
7+
public int deleteGreatestValue(int[][] grid) {
8+
int sum = 0;
9+
for (int i = 0; i < grid.length; i++) {
10+
Arrays.sort(grid[i]);
11+
}
12+
for (int j = grid[0].length - 1; j >= 0; j--) {
13+
int max = grid[0][j];
14+
for (int i = 1; i < grid.length; i++) {
15+
max = Math.max(max, grid[i][j]);
16+
}
17+
sum += max;
18+
}
19+
return sum;
20+
}
21+
}
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.fishercoder.thirdthousand;
2+
3+
import com.fishercoder.common.utils.CommonUtils;
4+
import com.fishercoder.solutions.thirdthousand._2500;
5+
import org.junit.jupiter.api.BeforeEach;
6+
import org.junit.jupiter.api.Test;
7+
8+
import static org.junit.jupiter.api.Assertions.assertEquals;
9+
10+
public class _2500Test {
11+
private static _2500.Solution1 solution1;
12+
13+
@BeforeEach
14+
public void setup() {
15+
solution1 = new _2500.Solution1();
16+
}
17+
18+
@Test
19+
public void test1() {
20+
assertEquals(8, solution1.deleteGreatestValue(CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[1,2,4],[3,3,1]")));
21+
}
22+
23+
24+
}

0 commit comments

Comments
 (0)