Task 6 of 7 · 0 solved · 7 to go0%
You can read the problem, but answers are checked only for signed-in students. Sign in to answer →

10.4 Patterns — count common values

Total: 0 / 3 pts
Practice mode — check each part and get hints as you go.
Task

Fill in countCommon so that it returns the number of distinct values appearing in both arrays.

Use two sets: one holding the values of a, another collecting the matches so repeats collapse. The program prints 2.

Your solution