Airbnb | Phone| coding round 2
Anonymous User
2729

A patron at a restaurant tells the waiter that out of the given menu, they’d like to order exactly $15.05 worth of appetizers. He offers the waiter computer science literature to help solve the problem.

// You are the waiter in this story. Given a total sum for appetizers (in the example $15.05), write a program which writes to the screen what the customer’s order could be.

// Menu:
// (“Fruit”, 2.15);
// (“Fries”, 2.75);
// (“Salad”, 3.35);
// (“Wings”, 3.55);
// (“Mozzarella”, 4.20);
// (“Plate”, 5.80);

// Examples
// possibleOrders(4.30) -> [[“Fruit”, “Fruit”]]
// possibleOrders(4.90) -> [[“Fruit”, “Fries”]]
// possibleOrders(5.50) -> [[“Fries”, “Fries”], [“Fruit”, “Salad”]]

// possibleOrders(15.05) -> [[“Fruit”, “Wings”, “Wings”, “Plate”], [“Fruit”, “Fruit”, “Fruit”, “Fruit”, “Fruit”, “Fruit”, “Fruit”]]
// 2.15+3.55+3.55+5.80 = 15.05
// if not possible return empty list
// Unique possible combination solution

Comments (10)