Loading...
Loading...
Loading...
A store has a list of valid coupon codes. Customers type some codes at checkout. For each typed code say whether it is on the valid list.
VALID or INVALID.Example
Input
3 SAVE10 NEW20 FREE5 3 NEW20 SAVE15 SAVE10
Output
VALID INVALID VALID
SAVE15 is not on the list.
Try the problem first. Open one hint at a time.
Put the valid codes in a HashSet.
contains answers each query without scanning the list.
Write your Java code, run it on the examples and submit it to hidden tests.
Solve in the editor