[Python3] two-line solution
Algorithm:\nConvert number into list of digits, and compute the difference of their product and sum. \n\nImplementation (28ms, 100%): \n\nfrom functools import 
Algorithm:\nConvert number into list of digits, and compute the difference of their product and sum. \n\nImplementation (28ms, 100%): \n```\nfrom functools import reduce\nfrom operator import mul\n\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n        digits = [int(x) for x in str(n)]\n        return reduce(mul, digits) - sum(digits)\n```\nAnalysis:\nTime complexity `O(logN)`\nSpace complexity `O(logN)`\n\nOne caveat is that `digits` cannot be generator i.e. `(int(x) for x in str(n))` as it is later used twice.
['Python3']