Pergunta de entrevista da empresa TaskRabbit

Technical screen: Given an array of needles, determine if a haystack contains each needle or not.

Resposta da entrevista

Sigiloso

31 de jan. de 2022

Create a hashmap of the haystack where the key is the value in the array, and the value is the count of number of occurrences. Iterate over the needle array and decrement the count in the hashmap if it is found. If not found or the count becomes negative, the haystack does not contain all the needles.

3