2160. Minimum Sum of Four Digit Number After Splitting Digits

Обновлено: 2024-03-12
1 мин
[]

Содержание

LeetCode problem 2160

class Solution:
    def minimumSum(self, num: int) -> int:
        nums = []
        while num:
            nums.append(num % 10)
            num //= 10
        nums.sort()
        return 10 * (nums[0] + nums[1]) + nums[2] + nums[3]