2160. Minimum Sum of Four Digit Number After Splitting Digits

Updated: 2024-03-12
1 min read
[]

On This Page

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]