Recursive Digit Sum

  • + 0 comments

    If you're having trouble with timeouts or the last 3 cases:

    1. Don't try to build a string of len(n) * k length or try to implement a loop over the string repeatedly - just calculate the sum of the digits of n then multiply by k
    2. If you fail cases 5, 7, 8 after that, make sure your integer type is at least 64 bits as the values for those cases overflow 32 bit integers (even though the setup for languages like golang always want 32 bit answers)