Skip to content

Instantly share code, notes, and snippets.

@azurast
Last active August 21, 2021 10:18
Show Gist options
  • Save azurast/8d36bd91b733d881c6c764ff13665559 to your computer and use it in GitHub Desktop.
Save azurast/8d36bd91b733d881c6c764ff13665559 to your computer and use it in GitHub Desktop.
Swift solution to the Hackkerrank Two Strings problem - First Attempt
/*
First Attempt
5/8 test cases passed
*/
func twoStrings(s1: String, s2: String) -> String {
for char in s2 {
if s1.contains(char) {
return "YES"
}
}
return "NO"
}
twoStrings(s1: "hello", s2: "world")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment