Taum and B’day

Parag Naik
2 min readMar 31, 2021

--

Problem Statement:-

Solution:-
A very simple one line solution to this problem. Here we are trying to find out the minimum cost at which we can buy both white and black gifts.

Photo by Adi Goldstein on Unsplash

If the cost of black gift is less than that of white gift we will convert the white gift into black along with a conversion factor added to the cost of black gifts and vice versa is also possible.Lets move towards the code.

def taumBday(b, w, bc, wc, z):
return min(b*bc+w*wc, b*(wc+z)+w*wc, b*bc+w*(bc+z))

This is a one-line problem statement where we find(return) the minimum value among the total cost without any conversion, total cost when we have converted the black gift into white and the total cost when we have converted the white gift into black.

Conclusion:-
Do today what others won’t so tomorrow you can do what others can’t.”
I have been away from this challenge but I have picked it up again from today.
Keep moving and keep hustling….(cheers:-PN)

--

--