Amazon Online Assessment
Anonymous User
4433

 codeList, a list of lists of strings representing the order and grouping of specific fruits that must be purchased in order to win the prize for the day. shoppingCart, a list of strings representing the order in which a customer purchases fruit
 Return an integer 1 if the customer is a winner else return 
 •anything' in the codeList represents that any fruit can be ordered in place of 
 •anything' in the group. 
 •anything' has to be something, it cannot be "nothing." 
 •anything' must represent one and only one fruit. If Secret code list is empty then it is assumed that the customer is a winner. E

codeList = [['apple', "apple"], ['banana', "anything", "banana"]];
shoppingCart = ['orange', 'apple', 'apple', 'banana', 'orange', 'banana']
  // Output 1 
  
  
codeList = [ ['orange'] ['apple', "apple"], ['banana', "orange", "apple"] ['banana']];
shoppingCart = ['orange', 'apple', 'apple', 'banana', 'orange', 'apple', 'banana']
// Output 1 
  

codeList = [ ['apple', "appricot"], ['banana', "anything", "guava"] ['papaya', 'anything]];
shoppingCart = ['banana', 'orange', 'guava', 'apple', 'appricot', 'papaya', 'kiwi']
//output 0
Comments (6)