LeetCode solutions

2386. Min Max Game

My accepted Python solution to LeetCode problem 2386, Min Max Game, running in 3ms.

  • Difficulty: Easy
  • Python
  • Runtime 3ms
  • Memory 17.4MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 3ms, memory 17.4MB, accepted 2025-12-29.

python
class Solution:
    def minMaxGame(self, nums: List[int]) -> int:
        while len(nums) > 1:
            newNums = []
            for i in range(len(nums) // 2):
                if i % 2 == 0:
                    newNums.append(min(nums[2*i], nums[2*i + 1]))
                else:
                    newNums.append(max(nums[2*i], nums[2*i + 1]))
            nums = newNums
        return nums[0]

Source