Question bank › Greedy
Dsa Greedy Warm-up

Dress Allocation

You are organizing a fashion show and have a limited number of dresses of different sizes. You want to allocate these dresses to models in a way that maximizes the number of models dressed. Each model can fit into one specific size. Given an array of integers representing the sizes of dresses and an array representing the sizes of models, determine the maximum number of models that can be dressed. Input Format: - The first line contains an integer n, the number of dresses. - The second line contains n space-separated integers representing the dress sizes. - The third line contains an integer m, the number of models. - The fourth line contains m space-separated integers representing the model sizes. Output Format: - An integer representing the maximum number of models that can be dressed. Example: Input: 5 1 2 2 3 4 3 2 3 5 Output: 3

Key concepts

greedysortingarray

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.