We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Recursive Digit Sum
- Discussions
Recursive Digit Sum
Recursive Digit Sum
Sort by
recency
|
202 Discussions
|
Please Login in order to post a comment
c++ solution
because the input is large, we gotta avoid creating the initial string by concatenating string n k times. Instead we calculate the sum of initial n and then multiply it by k to get sum of digits of concatenated k times string n. From then on, we simulate the process in the description - get the sum of string until its length is one.
Python solution
Explaining the code:
"@nemat-al/recursive-digit-sum-hackerrank-python-db446d084a89">https://medium.com/@nemat-al/recursive-digit-sum-hackerrank-python-db446d084a89"
C#