func intToArr(num: Int) -> Array<Int> { var intArr: [Int] = [] var number: Int = num while number > 0 { intArr.insert(number%10, at: 0) number = number/10 } return intArr }
func digits(_ number: Int) -> [Int] { if number >= 10 { let firstDigits = digits(number / 10) let lastDigit = number % 10 return firstDigits + [lastDigit] } else { return [number] } }