Skip to content

Commit 26a104f

Browse files
authored
Create the-employee-that-worked-on-the-longest-task.py
1 parent 2709ea5 commit 26a104f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Time: O(l)
2+
# Space: O(1)
3+
4+
# array
5+
class Solution(object):
6+
def hardestWorker(self, n, logs):
7+
"""
8+
:type n: int
9+
:type logs: List[List[int]]
10+
:rtype: int
11+
"""
12+
return logs[max(xrange(len(logs)), key=lambda x: (logs[x][1]-(logs[x-1][1] if x-1 >= 0 else 0), -logs[x][0]))][0]

0 commit comments

Comments
 (0)