2 parents 5a154ae + d1dc867 commit 2de0fcbCopy full SHA for 2de0fcb
1 file changed
leetcode3/최원준/1837. Sum of Digits in Base K.py
@@ -0,0 +1,9 @@
1
+class Solution:
2
+ def sumBase(self, n: int, k: int) -> int:
3
+ ans = 0
4
+
5
+ while n:
6
+ n, r = divmod(n, k)
7
+ ans += r
8
9
+ return ans
0 commit comments