Dsa
Hashing
Easy
Missing Ingredient Finder
You are given a list of ingredients required for a recipe and a list of ingredients you currently have. Write a program to find any ingredients that are missing from your current list. If all ingredients are present, output 'All ingredients available'.
Input:
- The first line contains a single integer n (1 ≤ n ≤ 1000), the number of ingredients in the recipe.
- The second line contains n space-separated strings representing the ingredients required.
- The third line contains a single integer m (1 ≤ m ≤ 1000), the number of ingredients you currently have.
- The fourth line contains m space-separated strings representing the ingredients you have.
Output:
- A space-separated list of missing ingredients or 'All ingredients available' if none are missing.
Example:
Input:
3
flour sugar eggs
2
eggs sugar
Output:
flour
Key concepts
hashingdictionariessets
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now