You are viewing a single comment's thread. Return to all comments →
Java
public static void checkMagazine(List<String> magazine, List<String> note) { boolean haveAllWords = true; for(String n : note) { if (magazine.contains(n)) { magazine.remove(n); } else { haveAllWords = false; break; } } if (haveAllWords) { System.out.println("Yes"); } else { System.out.println("No"); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Hash Tables: Ransom Note
You are viewing a single comment's thread. Return to all comments →
Java