Skip to content

Instantly share code, notes, and snippets.

@marciok
Created January 16, 2018 20:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marciok/efb498da181cd529df0f111e60118a81 to your computer and use it in GitHub Desktop.
Save marciok/efb498da181cd529df0f111e60118a81 to your computer and use it in GitHub Desktop.
func palin(_ str: String) -> Bool {
guard str.characters.count > 1 else { return true }
if str.characters.first != str.characters.last {
return false
}
let subword = String(Array(str.characters)[1..<str.characters.count - 1])
return palin(subword)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment