Skip to content

Commit 8ab0da5

Browse files
authored
Add_Digits_LeetCode 258
Initial File
1 parent a54c29f commit 8ab0da5

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

Add_Digits_LeetCode 258

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution(object):
2+
def addDigits(self, num):
3+
"""
4+
:type num: int
5+
:rtype: int
6+
"""
7+
if num == 0:
8+
return 0
9+
if num % 9==0:
10+
return 9
11+
return (num%9)
12+

0 commit comments

Comments
 (0)