You are viewing a single comment's thread. Return to all comments →
def superDigit(n, k):
str1 = str(n) sum1 = 0 for i in str1: sum1 += int(i) sum1 = sum1*k str2 = str(sum1) while len(str2) != 1: sum2 = 0 for i in str2: sum2 += int(i) str2 = str(sum2) return sum2
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Recursive Digit Sum
You are viewing a single comment's thread. Return to all comments →
def superDigit(n, k):