1
2
3
4
5
6
7
8
|
class Solution:
def subtractProductAndSum(self, n: int) -> int:
a,b=1,0
n=str(n)
for i in n:
a*=int(i)
b+=int(i)
return a-b
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
Leetcode 1389. Create Target Array in the Given Order (0) | 2021.07.16 |
---|---|
Leetcode 1342. Number of Steps to Reduce a Number to Zero (0) | 2021.07.15 |
Leetcode 1528. Shuffle String (0) | 2021.07.15 |
Leetcode 1365. How Many Numbers Are Smaller Than the Current Number (0) | 2021.07.15 |
Leetcode 88. Merge Sorted Array (0) | 2021.07.15 |
댓글