Created
June 1, 2021 01:50
-
-
Save Shaddyjr/556d803486359530cab7190d4b562d2f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# source: https://www.hackerrank.com/challenges/taum-and-bday/problem | |
# video: https://youtu.be/9vajRE0bJ5w | |
def taumBday(b, w, bc, wc, z): | |
# if black gifts > white gifts + z conversion cost | |
if bc > wc + z: | |
return (w * wc) + (b * (wc + z)) | |
# if white gifts > black gifts + z conversion cost | |
if wc > bc + z: | |
return (b * bc) + (w * (bc + z)) | |
# else, just buy as is | |
return b * bc + w * wc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment