Hash Tables: Ransom Note

  • + 0 comments

    JAVA 18 public static void checkMagazine(List magazine, List note) {

    boolean isFound = true;
    for(String word : note){
        if(!magazine.contains(word)){
            isFound = false;
        }else{
            magazine.remove(word);
        }
    }
    if(isFound){
        System.out.println("Yes");
    }else{
        System.out.println("No");
    }
    
    }
    

    }