From eac469684872e92cb80595ada1be06c6c37106c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=97=BC=ED=98=9C=EC=A0=95?= <122238744+cyzlcyzl@users.noreply.github.com> Date: Mon, 7 Sep 2026 23:39:27 +0900 Subject: [PATCH] Create 1837. Sum of Digits in Base K.java --- .../1837. Sum of Digits in Base K.java" | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 "leetcode3/\354\227\274\355\230\234\354\240\225/1837. Sum of Digits in Base K.java" diff --git "a/leetcode3/\354\227\274\355\230\234\354\240\225/1837. Sum of Digits in Base K.java" "b/leetcode3/\354\227\274\355\230\234\354\240\225/1837. Sum of Digits in Base K.java" new file mode 100644 index 00000000..fd35942e --- /dev/null +++ "b/leetcode3/\354\227\274\355\230\234\354\240\225/1837. Sum of Digits in Base K.java" @@ -0,0 +1,12 @@ +// O(logkn) + +class Solution { + public int sumBase(int n, int k) { + int total = 0; + while (n > 0) { + total += n % k; + n /= k; + } + return total; + } +}