
- Given 2 arrays, products and find the minimum price at which the product can be bought and return the minimum cost of all the bought products.
Product array contains the price of the product and discount tags => ['10', 'tag1', tag2]
Discount array contains the name of the tag and type and factor => ['tag1', 0 , 5]
There are 3 types of discount tags
Type 0 = flat amount in the discount to be considered for the amount;
Type 1 = Percentage discount. Multiply product price with the %dicount, deduct it from orignal price
Type 2 = Fixed Discount. Product discount - discount amount
The example in the image has following solution
for product 0 -> dicount d0 and d1 are applicable
d0 -> 10 - (10 * 0.27) = RoundOff(9.30) = 9
**d1 -> 10 - 5 = 5 **
for product 1 -> discount applicable none = 15
for product 2 -> dicount applicable d1
d1-> 20-5 = 15
Total price = Min(5,9) + 15 + 15 = 35
Constraints Products and Arrays can be from 1 to 1000 in length

- Given a List<List> we have to suggest y as a friend to user x where x & y are not frined.
If there are multiple possible y, consider minimum index.
The graph in the image is example
The output is (3,2,1,0,1)
for 0th user their existing friends are 2 and 1 and 3 is their mutual friend so suggest 3
similarly, for 1st user 2
for 2nd user 1
for 3rd user 0
for 4th user possibility is 2 and 1. Choose 1 becuase it has minimum index.
Contraints the size of the list can be max 10^5
Each user will have max 15 friends.
Was partially able to pass with 1st question but couldnt finish the 2nd one.
This is my first post. Please pardon me if somethings incorrect.