Grid Game LeetCode solution in Python

1
# Runtime: 2175 ms (Top 21.39%) | Memory: 30.5 MB (Top 29.48%)
2

3

4
class Solution:
5
def gridGame(self, g: List[List[int]]) -> int:
6
top, bottom, res = sum(g[0]), 0, math.inf
7
for g0, g1 in zip(g[0], g[1]):
8
top -= g0
9
res = min(res, max(top, bottom))
10
bottom += g1
11
return res

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0