Skip to content

Commit eee5a93

Browse files
add 598
1 parent d33a25f commit eee5a93

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/main/java/com/fishercoder/solutions/_598.java

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
public class _598 {
44

55
public static class Solution1 {
6+
/**
7+
* Since the incrementing starts from zero to op[0] and op[1], we only need to find the range that has the most overlaps.
8+
* Thus we keep finding the minimum of both x and y.
9+
*/
610
public int maxCount(int m, int n, int[][] ops) {
711
int x = m;
812
int y = n;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package com.fishercoder;
2+
3+
import com.fishercoder.common.utils.CommonUtils;
4+
import com.fishercoder.solutions._598;
5+
import org.junit.BeforeClass;
6+
import org.junit.Test;
7+
8+
import static org.junit.Assert.assertEquals;
9+
10+
public class _598Test {
11+
private static _598.Solution1 solution1;
12+
13+
@BeforeClass
14+
public static void setup() {
15+
solution1 = new _598.Solution1();
16+
}
17+
18+
@Test
19+
public void test1() {
20+
assertEquals(4, solution1.maxCount(3, 3, CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,2],[3,3]")));
21+
}
22+
23+
}

0 commit comments

Comments
 (0)