You are viewing a single comment's thread. Return to all comments →
Java
public static String gameOfThrones(String s) { List<String> str = Arrays.asList(s.split("")); List<String> uniqueChar = new ArrayList<>(new LinkedHashSet<>(Arrays.asList(s.split("")))); int oddLetters = 0; for (int i = 0; i < uniqueChar.size(); i++) { if (Collections.frequency(str, uniqueChar.get(i)) % 2 == 1) { if (++oddLetters > 1) { return "NO"; } } } return "YES"; }
Seems like cookies are disabled on this browser, please enable them to open this website
Game of Thrones - I
You are viewing a single comment's thread. Return to all comments →
Java