## .css-1vg6q84{font-weight:700;}HONING .css-12hdkks{display:inline-block;-webkit-transform:rotate(-10deg);-moz-transform:rotate(-10deg);-ms-transform:rotate(-10deg);transform:rotate(-10deg);-webkit-transition:all 0.25s;transition:all 0.25s;}[role=group]:hover .css-12hdkks,[role=group][data-hover] .css-12hdkks,[data-group]:hover .css-12hdkks,[data-group][data-hover] .css-12hdkks,.group:hover .css-12hdkks,.group[data-hover] .css-12hdkks{-webkit-transform:rotate(0deg);-moz-transform:rotate(0deg);-ms-transform:rotate(0deg);transform:rotate(0deg);}JS

Could work with string instead of using math

## Implementation

```.css-ds3kc{display:table-row;}.css-1t8atru{display:table-cell;opacity:0.5;padding-right:var(--chakra-space-6);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:right;}1.css-2qghsv{display:table-cell;}var addDigits = function (num) {2  num = String(num)3
4  while (num.length > 1) {5    num = String(num.split("").reduce((acc, el) => acc + +el, 0))6  }7
8  return +num9}```

Original problem

## Similar problems

Happy Number

Sum of Digits in the Minimum Number

Sum of Digits of String After Convert

Minimum Sum of Four Digit Number After Splitting Digits

Calculate Digit Sum of a String

leetcode

math

string

## Next Post

LeetCode: Sum of Digits of String After Convert

Sep 15, 2022

Solving a problem in one go is such a good feeling

## Previous Post

CodeWars: Sudoku Solution Validator

Sep 14, 2022

Three checks

Search Posts