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

Commit88f9efb

Browse files
add 1450
1 parent41c08cf commit88f9efb

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

‎README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|-----|----------------|---------------|--------|-------------|-------------
11+
|1450|[Number of Students Doing Homework at a Given Time](https://leetcode.com/problems/number-of-students-doing-homework-at-a-given-time/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1450.java)||Easy|Array|
1112
|1448|[Count Good Nodes in Binary Tree](https://leetcode.com/problems/count-good-nodes-in-binary-tree/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1448.java)||Medium|Tree, DFS|
1213
|1447|[Simplified Fractions](https://leetcode.com/problems/simplified-fractions/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1447.java)||Medium|Math|
1314
|1446|[Consecutive Characters](https://leetcode.com/problems/consecutive-characters/)|[Solution](../master/src/main/java/com/fishercoder/solutions/_1446.java)||Easy|String|
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
packagecom.fishercoder.solutions;
2+
3+
publicclass_1450 {
4+
publicstaticclassSolution1 {
5+
publicintbusyStudent(int[]startTime,int[]endTime,intqueryTime) {
6+
intcount =0;
7+
for (inti =0;i <startTime.length;i++) {
8+
if (startTime[i] <=queryTime &&endTime[i] >=queryTime) {
9+
count++;
10+
}
11+
}
12+
returncount;
13+
}
14+
}
15+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
packagecom.fishercoder;
2+
3+
importcom.fishercoder.solutions._1450;
4+
importorg.junit.BeforeClass;
5+
importorg.junit.Test;
6+
7+
importstaticjunit.framework.TestCase.assertEquals;
8+
9+
publicclass_1450Test {
10+
privatestatic_1450.Solution1solution1;
11+
privatestaticint[]startTime;
12+
privatestaticint[]endTime;
13+
14+
@BeforeClass
15+
publicstaticvoidsetup() {
16+
solution1 =new_1450.Solution1();
17+
}
18+
19+
@Test
20+
publicvoidtest1() {
21+
startTime =newint[]{1,2,3};
22+
endTime =newint[]{3,2,7};
23+
assertEquals(1,solution1.busyStudent(startTime,endTime,4));
24+
}
25+
26+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp