Skip to content

Instantly share code, notes, and snippets.

class Solution:
def predictTheWinner(self, nums: List[int]) -> bool:
memo = {}
def minimax(i, j):
"""Returns max score diff the current player can guarantee from nums[i..j]"""
if i == j:
return nums[i]
if (i, j) in memo:
return memo[(i, j)]