From 96859f77e091ec6c5b6f2071cc3db3c56b6093f1 Mon Sep 17 00:00:00 2001 From: dmswl6310 Date: Mon, 7 Sep 2026 18:23:45 +0900 Subject: [PATCH] 0907 --- .../1837. Sum of Digits in Base K.js" | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 "leetcode3/\355\231\251\354\235\200\354\247\200/1837. Sum of Digits in Base K.js" 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