1503. Last Moment Before All Ants Fall Out of a Plank

Updated: 2024-03-12
1 min read
[]

On This Page

LeetCode problem 1503

class Solution:
    def getLastMoment(self, n: int, left: List[int], right: List[int]) -> int:
        res = 0
        for x in left:
            res = max(res, x)
        for x in right:
            res = max(res, n - x)
        return res