We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Taum and B'day
Taum and B'day
Sort by
recency
|
933 Discussions
|
Please Login in order to post a comment
Here is my simple c++ solution, you can watch the explanation here : https://youtu.be/T9sxEzAbp-M
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.
some one may get the same issue. * First Code's logic is correct but it fails for some test cases, becuase of total cost is computed on all intgers (b, bc, w, wc, z), not on the long data types.
This is my code in C#
Haskell: