Skip to content

Instantly share code, notes, and snippets.

@AustinBCole
Created November 14, 2018 16:45
Show Gist options
  • Save AustinBCole/97c2ecfc0ba44d03d14f176c2f77dd9a to your computer and use it in GitHub Desktop.
Save AustinBCole/97c2ecfc0ba44d03d14f176c2f77dd9a to your computer and use it in GitHub Desktop.
Daily Challenge Nov 14
func expandedNumber(number: Int) -> [Int] {
var numberArray : [Int] = []
if number < 1000 {
let numberString = String(number)
let count = numberString.count
for place in count...1 {
let newNumber = number % (10^place)
numberArray.append(number - newNumber)
}
}
return numberArray
}
expandedNumber(number: 245)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment