You are viewing a single comment's thread. Return to all comments →
Go solution
func SuperDigit(digits string, times int) string { if len(digits) <= 1 { return digits } return SuperDigit(digitSum(digits, times), 1) } func digitSum(digits string, times int) string { sum := 0 for _, digit := range digits { sum += int(digit - '0') } return strconv.Itoa(sum * times) }
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 →
Go solution