MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / gridGame

Method gridGame

python/2017-grid-game.py:4–12  ·  view source on GitHub ↗
(self, grid)

Source from the content-addressed store, hash-verified

2
3class Solution(object):
4 def gridGame(self, grid):
5 result = float("inf")
6 left, right = 0, sum(grid[0])
7
8 for a, b in zip(grid[0], grid[1]):
9 right -= a
10 result = min(result, max(left, right))
11 left += b
12 return result

Callers

nothing calls this directly

Calls 3

sumFunction · 0.50
minFunction · 0.50
maxFunction · 0.50

Tested by

no test coverage detected