You are viewing a single comment's thread. Return to all comments →
This seems quite straightforward.
static String twoStrings(String s1, String s2) { String [] array1 = s1.split(""); String [] array2 = s2.split(""); Set<String> set1 = new HashSet(); Collections.addAll(set1, array1); Set<String> set2 = new HashSet(); Collections.addAll(set2, array2); boolean result = Collections.disjoint(set1, set2); if (result) return "NO"; else return "YES"; }
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 →
This seems quite straightforward.