From d1dc867022a7d063eab5f4a616ea83b3b3d3ddee Mon Sep 17 00:00:00 2001 From: Won Joon Thomas Choi <113500771+724thomas@users.noreply.github.com> Date: Mon, 7 Sep 2026 20:17:12 +0900 Subject: [PATCH] Create 1837. Sum of Digits in Base K.py --- .../1837. Sum of Digits in Base K.py" | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 "leetcode3/\354\265\234\354\233\220\354\244\200/1837. Sum of Digits in Base K.py" diff --git "a/leetcode3/\354\265\234\354\233\220\354\244\200/1837. Sum of Digits in Base K.py" "b/leetcode3/\354\265\234\354\233\220\354\244\200/1837. Sum of Digits in Base K.py" new file mode 100644 index 00000000..da567376 --- /dev/null +++ "b/leetcode3/\354\265\234\354\233\220\354\244\200/1837. Sum of Digits in Base K.py" @@ -0,0 +1,9 @@ +class Solution: + def sumBase(self, n: int, k: int) -> int: + ans = 0 + + while n: + n, r = divmod(n, k) + ans += r + + return ans