1281. Subtract the Product and Sum of Digits of an Integer

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

Содержание

LeetCode problem 1281

class Solution:
    def subtractProductAndSum(self, n: int) -> int:
        nums = list(map(int, str(n)))
        return prod(nums) - sum(nums)