• + 0 comments

    Here is my one line Python solution! There are three candidates for the lowest cost, buying all of them at the normal price, buying all black presents and converting to white presents, or buying all white presents and converting to black presents. Then, we return the smallest of these prices.

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