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
|
539 Discussions
|
Please Login in order to post a comment
Javascript solution:
Test cases are ridiculously big. Had to modify it 3 times. Here is mine in C#
Swift
Quite harsh problem considering the constraints, some attention must be paid to the typing of the problem.
def superDigit(n, k): # Write your code here supdig = (sum(list(map(int,n))))%9
supdig = int(supdig*k)%9 if supdig ==0: supdig = 9
return int(supdig)