Skip to content

Instantly share code, notes, and snippets.

@digoreis
Last active February 15, 2016 21:20
Show Gist options
  • Save digoreis/76b4af6dc0482cef93d0 to your computer and use it in GitHub Desktop.
Save digoreis/76b4af6dc0482cef93d0 to your computer and use it in GitHub Desktop.
Example for Problem Siblings Integer
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