You are viewing a single comment's thread. Return to all comments →
Python Solution
def superDigit(n, k): def solve(n): if len(n)==1: return n[0] sum = 0 for digit in n: sum+=int(digit) return solve(list(str(sum))) sum=0 for digit in n: sum+=int(digit) sum*=k result = solve(list(str(sum))) return result
Seems like cookies are disabled on this browser, please enable them to open this website
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
Python Solution