Skip to main content

Practice · 4 of 5

Same Multiset?

CHALLENGE
Difficulty: intermediate+25 XP

**Description:** Two bags of numbers are given. Print SAME if they contain exactly the same values with exactly the same multiplicities, else DIFF. **Input:** Line 1: n m (1 ≤ n, m ≤ 10^5). Line 2: n values (0..10^5). Line 3: m values (0..10^5). **Output:** SAME or DIFF. **Example:** 3 3 / 1 2 2 / 2 1 2 → SAME; 3 3 / 1 2 2 / 1 1 2 → DIFF.

Back to lesson: Practice: Marking Array Set