0 ms solution easy to understand.
\n int subtractProductAndSum(int n) {\n       int t1=0,t2=1;\n        while(n){\n             t1+=n%10;\n             t2*=n%10;\n            n/=10;\n        }\n
```\n int subtractProductAndSum(int n) {\n       int t1=0,t2=1;\n        while(n){\n             t1+=n%10;\n             t2*=n%10;\n            n/=10;\n        }\n        return t2-t1;\n    }\n```
[]