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
|
921 Discussions
|
Please Login in order to post a comment
Hi there! Here's my Java solution:
https://github.com/eduardocintra/hacker-rank-solutions/blob/master/src/br/com/eduardocintra/easy/taumandbday/TaumAndBDay.java
Here is my simple c++ solution, you can watch the explanation here : https://youtu.be/T9sxEzAbp-M
My solution in Java, time complexity: O(1).
Oneliner
Just calculate three prices: 1. Total Price when gifts are bought at their original price without conversion 2. Total Price when gifts are bought at price of black (bc) and converated to white 3. Total Price when gifts are bought at price of white (wc) and converated to black 4. Just return the minimum cost
Java