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; + } +}