본문 바로가기
python-algorithm

3232. Find if Digit Game Can Be Won

by 무적김두칠 2024. 9. 21.

https://leetcode.com/problems/find-if-digit-game-can-be-won/description/

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
class Solution:
    def canAliceWin(self, nums: List[int]) -> bool:
        sum_single, sum_double = 00
        for num in nums:
            if num < 10 :
                sum_single += num
            else:
                sum_double += num
 
        if sum_single == sum_double:
            return False
        else:
            return True
        
cs

한 자리수 숫자의 합
두자리수 숫자의합을 비교

반응형

댓글