Loading...
Loading...
Loading...
A customer may sign up for a sale more than once. Keep only the first sign-up of each customer, in the original order, and count how many repeats were dropped.
Unique: <count>, then the unique names on one line separated by spaces, then Dropped: <count>.Example
Input
5 Asha Ravi Asha Meena Ravi
Output
Unique: 3 Asha Ravi Meena Dropped: 2
Try the problem first. Open one hint at a time.
Build a second list of the names seen so far.
Add a name only when unique.contains(name) is false.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor