Subtract the Product and Sum of Digits of an Integer

Given an integer number n, calculate the difference between the product of its digits and the sum of its digits.

Constraints

  • 1 <= n <= 10^5
Saving… · 2 lines
class Solution:
def subtractProductAndSum(self, n: int) -> int:
Console

Click Run to execute sample tests.