Python 3 (one line) (beats 100%)
Three Line Version: (20 ms) (beats 100%)\n\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n        s, p = 0, 1\n        for i in str(n): 
_Three Line Version:_ (20 ms) (beats 100%)\n```\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n        s, p = 0, 1\n        for i in str(n): s += int(i); p *= int(i)\n        return p - s\n\t\t\n```\n_One-Line Version:_ (beats 100%)\n```\nfrom numpy import prod\n\nclass Solution:\n    def subtractProductAndSum(self, n: int) -> int:\n        return (lambda n: prod(n) - sum(n))(list(map(int,str(n))))\n\n\n- Junaid Mansuri\n- Chicago, IL
['Python', 'Python3']