2017. Grid Game

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

On This Page

LeetCode problem 2017

class Solution:
    def gridGame(self, grid: List[List[int]]) -> int:
        res = inf
        s1, s2 = sum(grid[0]), 0
        for j, v in enumerate(grid[0]):
            s1 -= v
            res = min(res, max(s1, s2))
            s2 += grid[1][j]
        return res