LeetCode_1281. Subtract the Product and Sum of Digits of an Integer

重要知識點:

1.map,對一個list每個元素做操作

2.reduce,累計做操作,add 加,sub減,mul乘,div除

 ls=map(int,list(str(n)))

 return reduce(mul,ls)-reduce(add,ls)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章