Last active
February 15, 2016 21:20
-
-
Save digoreis/76b4af6dc0482cef93d0 to your computer and use it in GitHub Desktop.
Example for Problem Siblings Integer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func generateHigherInteger(number:Int) -> Int { | |
let siblingsStr = String(number).characters.map { String($0) } | |
let bigSibling = siblingsStr.sort(>).reduce("", combine:+) | |
return Int(bigSibling) ?? number | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment