Reverse Map Count

Programming Interview Medium 6 views
Back to Questions

Problem Description

You're given {x}. Build reverse mapping: for each value, how many keys map to it. Output values sorted with their counts.

Input Format

First line n. Next n lines: key value.

Output Format

Lines: value count.

Sample Test Case

Input:
5 a 1 b 2 c 2 d 3 e 2
Output:
1 1 2 3 3 1

Constraints

1

Solutions (0)

No solutions submitted yet. Be the first!

Discussion (0)

No comments yet. Start the discussion!

Prev Next