Last active
August 21, 2021 10:27
-
-
Save azurast/d116d44f426208403cedcbd1e802d864 to your computer and use it in GitHub Desktop.
Swift solution to the Hackkerrank Two Strings problem - Final Attempt
This file contains hidden or 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
/* | |
Final Attempt | |
8/8 test cases passed | |
*/ | |
func twoStrings(s1: String, s2: String) -> String { | |
let uniqueCharacters = Set(s2) | |
for char in uniqueCharacters { | |
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