Interview Questions/Coding/Balanced Training Pods

Balanced Training Pods

Preview mode. Log in to edit, run, submit, and save progress.

Easy

Balanced Training Pods

A training camp labels each student by their strongest skill: 1 for analysis, 2 for implementation, and 3 for debugging. A balanced practice pod must contain exactly one student of each skill, and a student can belong to at most one pod. For each camp snapshot, compute the maximum number of complete balanced pods that can be formed. Input Format: The first line contains t, the number of test cases. Each test case contains n followed by n skill labels. Output Format: For each test case, print the number of complete pods.

Examples

Example 1
Input:
1
6
1 2 3 1 2 3
Output:
2

Explanation: There are two students of each skill, so two complete pods can be formed.

Approach hint

Start with the simplest clear approach, explain the trade-off, then move toward the cleaner answer.

Common mistake

Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.

solution.cpp