Loading...
Loading...
Loading...
Every order must have its own id. Read the ids of today's orders and check whether the same id appears twice.
DUPLICATE if some id appears more than once, otherwise ALL UNIQUE.Example 1
Input
4 ORD1 ORD2 ORD3 ORD2
Output
DUPLICATE
ORD2 appears twice.
Example 2
Input
3 ORD1 ORD2 ORD3
Output
ALL UNIQUE
Try the problem first. Open one hint at a time.
add returns false when the value is already in the set.
Stop as soon as one add returns false, or remember it with a boolean.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor