Skip to content

Commit d0268db

Browse files
committed
Improved task
1 parent bbb36df commit d0268db

File tree

2 files changed

+25
-6
lines changed
  • src
    • main/java/g3401_3500/s3414_maximum_score_of_non_overlapping_intervals
    • test/java/g3401_3500/s3414_maximum_score_of_non_overlapping_intervals

2 files changed

+25
-6
lines changed

src/main/java/g3401_3500/s3414_maximum_score_of_non_overlapping_intervals/Solution.java

-6
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ private int check(final int[] ns1, final int[] ns2) {
7070
}
7171
i++;
7272
}
73-
if (i < ns1.length) {
74-
return 1;
75-
}
76-
if (i < ns2.length) {
77-
return -1;
78-
}
7973
return 0;
8074
}
8175
}

src/test/java/g3401_3500/s3414_maximum_score_of_non_overlapping_intervals/SolutionTest.java

+25
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,29 @@ void maximumWeight() {
2121
List.of(8, 9, 1))),
2222
equalTo(new int[] {2, 3}));
2323
}
24+
25+
@Test
26+
void maximumWeight2() {
27+
assertThat(
28+
new Solution()
29+
.maximumWeight(
30+
List.of(
31+
List.of(5, 8, 1),
32+
List.of(6, 7, 7),
33+
List.of(4, 7, 3),
34+
List.of(9, 10, 6),
35+
List.of(7, 8, 2),
36+
List.of(11, 14, 3),
37+
List.of(3, 5, 5))),
38+
equalTo(new int[] {1, 3, 5, 6}));
39+
}
40+
41+
@Test
42+
void maximumWeight3() {
43+
assertThat(
44+
new Solution()
45+
.maximumWeight(
46+
List.of(List.of(4, 4, 1), List.of(2, 5, 3), List.of(2, 3, 2))),
47+
equalTo(new int[] {0, 2}));
48+
}
2449
}

0 commit comments

Comments
 (0)