File tree 2 files changed +7
-1
lines changed
2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change 78
78
| 252 | 🔒 [ Meeting Rooms] ( https://leetcode.com/problems/meeting-rooms ) | Easy | |
79
79
| 256 | 🔒 [ Paint House] ( https://leetcode.com/problems/paint-house ) | Easy | |
80
80
| 257 | [ Binary Tree Paths] ( https://leetcode.com/problems/binary-tree-paths ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/BinaryTreePaths.java ) [ ![ Python] ( https://img.icons8.com/color/35/000000/python.png )] ( python/binary_tree_paths.py ) |
81
- | 258 | [ Add Digits] ( https://leetcode.com/problems/add-digits ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/AddDigits.java ) |
81
+ | 258 | [ Add Digits] ( https://leetcode.com/problems/add-digits ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/AddDigits.java ) [ ![ Python ] ( https://img.icons8.com/color/35/000000/python.png )] ( python/add_digits.py ) |
82
82
| 263 | [ Ugly Number] ( https://leetcode.com/problems/ugly-number ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/UglyNumber.java ) |
83
83
| 266 | [ Palindrome Permutation] ( https://leetcode.com/problems/palindrome-permutation ) | Easy | |
84
84
| 268 | [ Missing Number] ( https://leetcode.com/problems/missing-number ) | Easy | [ ![ Java] ( https://img.icons8.com/color/40/000000/java-coffee-cup-logo.png )] ( src/MissingNumber.java ) |
Original file line number Diff line number Diff line change
1
+ class Solution :
2
+ def addDigits (self , num : int ) -> int :
3
+ number_str = str (num )
4
+ if len (number_str ) == 1 :
5
+ return num
6
+ return self .addDigits (sum (int (digit ) for digit in number_str ))
You can’t perform that action at this time.
0 commit comments