Task 4 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.2 HashSet — detect a duplicate

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

Fill in hasDuplicate so that it returns true when a value appears more than once.

Keep a set of values already seen; check before adding, otherwise every value looks like a repeat. The program prints true and then false.

Your solution