2293. Min Max Game — Daily Problem
Although it's a simple problem, it involves a recursive idea.
The approach is to continuously convert the 1D list into a 2D list for processing (this avoids index confusion caused by in-place changes), then use a flag counter to compare maximum and minimum values.
At the end, return the only remaining number — though we know it must be nums[0] by this point, we still use nums[0] to avoid warnings.
class Solution:
def minMaxGame(self, nums: List[int]) -> int:
flag = 0
while len(nums) > 1:
nums = [nums[i:i + 2] for i in range(0, len(nums), 2)]
# split into 2D
for i in range(len(nums)):
if flag % 2 == 0:
nums[i] = min(nums[i])
flag += 1
else:
nums[i] = max(nums[i])
flag += 1
return nums[0]贡献者
最近更新
Involution Hell© 2026 byCommunityunderCC BY-NC-SA 4.0
One question daily 2293. Great mini game
LeetCode 2293. 极大极小游戏 题解 — 通过递归思想将一维数组不断转化为二维数组操作,避免索引变化混乱;利用 flag 计数交替取最大值与最小值,适合正在刷简单题、巩固递归与数组处理技巧的算法初学者。
2299. Strong Password Checker II — Daily Problem
LeetCode 2299. Strong Password Checker II — Simulate password validation with bitmask tracking lowercase, uppercase, digit, and special characters; O(n) time, for LeetCode solvers.