Unique Copy Archive
Preview mode. Log in to edit, run, submit, and save progress.
Unique Copy Archive
An archive receives n document fingerprints. Duplicate copies of the same fingerprint may arrive many times, but the archive only needs to keep one copy of each distinct fingerprint. For every archive batch, report how many unique fingerprints must be stored. Input Format: The first line contains t, the number of test cases. Each test case contains n followed by n fingerprint values. Output Format: For each test case, print the number of unique fingerprints.
Examples
1 5 1 2 2 3 1
3
Explanation: The unique fingerprints are 1, 2, and 3.
Approach hint
Start with a simple approach, explain the trade-off, then move toward a cleaner or more scalable solution.
Common mistake
Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.
1
5
1 2 2 3 13