Dashboard Temp Share Shortlinks Frames API

HTMLify

index.py
Views: 2 | Author: devwajahat
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
class Solution:
    def differenceOfSum(self, nums: List[int]) -> int:
        
        x = 0
        y = 0

        for i in nums:

            x += i

            while i > 0:

                digit = i % 10
                y = y + digit
                i = i // 10

          

        return x - y