Last Moment Before All Ants Fall Out of a Plank LeetCode solution in Python

1
# Runtime: 316 ms (Top 23.17%) | Memory: 15 MB (Top 18.90%)
2
class Solution:
3
def getLastMoment(self, n: int, left: List[int], right: List[int]) -> int:
4
# make sure left and right are not empty without changing the answer
5
left.append(0)
6
right.append(n)
7

8
return max(max(left), n - min(right))

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0