2025-08-23 17:17:19 +0000 UTC

Find if Digit Game Can Be Won

Code

class Solution:
    def canAliceWin(self, nums: List[int]) -> bool:
        sm_single, sm_double, sm_all = 0, 0, 0
        for num in nums:
            if num < 10:
                sm_single += num
            elif num < 100:
                sm_double += num
            sm_all += num
        return sm_single > (sm_all - sm_single) or sm_double > (sm_all - sm_double)