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

Commit 810058e

Browse files
Create 3633.py
1 parent 42d5f3b commit 810058e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

‎3501-4000/3633.py‎

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class Solution:
2+
def earliestFinishTime(self, a, b, c, d):
3+
ans = float('inf')
4+
# take land first
5+
6+
n = len(a)
7+
minEnd = float('inf')
8+
for i in range(n):
9+
minEnd = min(minEnd, a[i] + b[i])
10+
m = len(c)
11+
12+
for i in range(m):
13+
ans = min(ans, d[i] + max(minEnd, c[i]))
14+
15+
# take water first
16+
minEnd = float('inf')
17+
for i in range(m):
18+
minEnd = min(minEnd, c[i] + d[i])
19+
20+
for i in range(n):
21+
ans = min(ans, b[i] + max(minEnd, a[i]))
22+
23+
return ans

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /