Loading...
Loading...
Loading...
The store has a list of customer names for today's orders, and a customer who ordered twice appears twice. Print every customer once, in alphabetical order.
Example
Input
5 Rohan Priya Rohan Aarav Diya
Output
Aarav Diya Priya Rohan
Rohan appears twice but is printed once.
Try the problem first. Open one hint at a time.
A TreeSet drops duplicates and keeps values sorted.
Loop over the TreeSet and print one name per line.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor