diff --git "a/leetcode3/\355\231\251\354\235\200\354\247\200/1837. Sum of Digits in Base K.js" "b/leetcode3/\355\231\251\354\235\200\354\247\200/1837. Sum of Digits in Base K.js" new file mode 100644 index 00000000..8806963e --- /dev/null +++ "b/leetcode3/\355\231\251\354\235\200\354\247\200/1837. Sum of Digits in Base K.js" @@ -0,0 +1,9 @@ +/** + * @param {number} n + * @param {number} k + * @return {number} + */ +var sumBase = function(n, k) { + const changedNumStr=n.toString(k) + return changedNumStr.split('').reduce((acc,cur)=>acc+Number(cur),0); +}; \ No newline at end of file