You are viewing a single comment's thread. Return to all comments →
Java:
public static String twoStrings(String s1, String s2) { HashSet<String> string1 = new HashSet<>(Arrays.asList(s1.split(""))); HashSet<String> string2 = new HashSet<>(Arrays.asList(s2.split(""))); string1.retainAll(string2); int size = string1.size(); return size > 0 ? "YES" : "NO"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Two Strings
You are viewing a single comment's thread. Return to all comments →
Java: