Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteee5a93

Browse files
add 598
1 parentd33a25f commiteee5a93

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
publicclass_598 {
44

55
publicstaticclassSolution1 {
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
publicintmaxCount(intm,intn,int[][]ops) {
711
intx =m;
812
inty =n;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
packagecom.fishercoder;
2+
3+
importcom.fishercoder.common.utils.CommonUtils;
4+
importcom.fishercoder.solutions._598;
5+
importorg.junit.BeforeClass;
6+
importorg.junit.Test;
7+
8+
importstaticorg.junit.Assert.assertEquals;
9+
10+
publicclass_598Test {
11+
privatestatic_598.Solution1solution1;
12+
13+
@BeforeClass
14+
publicstaticvoidsetup() {
15+
solution1 =new_598.Solution1();
16+
}
17+
18+
@Test
19+
publicvoidtest1() {
20+
assertEquals(4,solution1.maxCount(3,3,CommonUtils.convertLeetCodeIrregularLengths2DArrayInputIntoJavaArray("[2,2],[3,3]")));
21+
}
22+
23+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp