Amazon Online Assessment (OA) - Secret Fruit List
A company is running a promotion. Customers who purchase a secret list of fruits will receive prizes. Note that the order of the fruits matters.
Also, there can be a keyword anything
in the secretFruitList which can be used for any type of fruit.
Examples
Example 1:
Input:
customerPurchasedList = [orange, mango, strawberry, watermelon, mango]
secretFruitLists = [[orange, mango], [watermelon, mango]]
Output: true
Example 2:
Input:
customerPurchasedList = [watermelon, orange, mango]
secretFruitLists = [[watermelon, anything, mango]]
Output: true
Example 3:
Input:
customerPurchasedList = [watermelon, apple, orange, mango]
secretFruitLists = [[watermelon, anything, mango]]
Output: false
Try it yourself
Got a question?ย Ask the Teaching Assistantย anything you don't understand.
Still not clear? Ask in the Forum, ย Discordย orย Submitย the part you don't understand to our editors.