0% found this document useful (0 votes)
2 views2 pages

Assignment - Buy One Get One Free - Java - Python

The document outlines a marketing campaign for a Diwali sale featuring a 'Buy One Get One Free' (BOGO) offer with specific rules for maximizing discounts. Customers can pair products based on their prices to maximize savings, with different rules for pairing items based on equality and less-than conditions. Examples are provided to illustrate how customers can achieve discounted and payable items based on the given price lists.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Assignment - Buy One Get One Free - Java - Python

The document outlines a marketing campaign for a Diwali sale featuring a 'Buy One Get One Free' (BOGO) offer with specific rules for maximizing discounts. Customers can pair products based on their prices to maximize savings, with different rules for pairing items based on equality and less-than conditions. Examples are provided to illustrate how customers can achieve discounted and payable items based on the given price lists.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Assignment: Buy one Get one Free in Python

The Big Diwali Sale:


The Diwali sale is approaching. The marketing team has decided to run a campaign called
“BOGO” - Buy one Get one Free. Customers can buy any number of products.

Offer Rules: Customers can buy one product and get another product for free as long as the
price of the product is equal to or less than the price of the first product.

Customer Objective: Discount maximization for Customers. The customer’s objective is to


create a pair of 2 items so that the discount is maximized.

Example1:
Input:
Product Price List = [ 10,20,30,40,50,60 ]
Output:
Discounted Items = [50,30,10]
Payable Items = [60,40,20]

Example 2:
Input:
Product Price List = [ 10,20,30,40,50,50,60 ]
Output:
Discounted Items = [50,40,20]
Payable Items = [60,50, 30,10]

--------------

Offer Rule 2: Customers can buy one product and get another product for free as long as the
price of the product is less than the price of the corresponding product in pairs.

Example 1 :
Input:
Product Price List = [ 10,20,30,40,40,50,60,60 ]
Output:
Discounted Items = [50,40,30,10]
Payable Items = [60,60,40, 20]
Example 2:
Input:
Product Price List = [ 10,20,30,40,50,50,50,60 ]
Output:
Discounted Items = [50,40,30,10]
Payable Items = [60,50,50,,20]

--------------

Offer Rule 3: Customers can buy two products and get two products for free as long as the
price of the product is less than the price of the first product.

Example1:
Input:
Product Price List = [ 10,20,30,40,40,50,60,60 ]
Output:
Discounted Items = [50,40,30,10]
Payable Items = [60,60,40, 20]

Example1:
Input:
Product Price List = [ 5,5,10,20,30,40,50,50,50,60 ]
Output:
Discounted Items = [50,40,30,10]
Payable Items = [60,50,50,,20,5,5]

You might also like