Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0adbbb0

Browse files
add 2432
1 parent 2cb7d89 commit 0adbbb0

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-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+
| 2432 |[The Employee That Worked on the Longest Task](https://leetcode.com/problems/the-employee-that-worked-on-the-longest-task/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2432.java) || Easy ||
1112
| 2399 |[Check Distances Between Same Letters](https://leetcode.com/problems/check-distances-between-same-letters/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2399.java) || Medium ||
1213
| 2395 |[Find Subarrays With Equal Sum](https://leetcode.com/problems/find-subarrays-with-equal-sum/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2395.java) || Easy ||
1314
| 2380 |[Time Needed to Rearrange a Binary String](https://leetcode.com/problems/time-needed-to-rearrange-a-binary-string/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2380.java) || Medium ||
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _2432 {
4+
public static class Solution1 {
5+
public int hardestWorker(int n, int[][] logs) {
6+
int startTime = 0;
7+
int maxDuration = 0;
8+
int result = 0;
9+
for (int i = 0; i < logs.length; i++) {
10+
int duration = logs[i][1] - startTime;
11+
startTime = logs[i][1];
12+
if (duration > maxDuration) {
13+
result = logs[i][0];
14+
maxDuration = duration;
15+
} else if (duration == maxDuration) {
16+
if (logs[i][0] < result) {
17+
result = logs[i][0];
18+
}
19+
}
20+
}
21+
return result;
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)