Ad
  • Custom User Avatar

    Damn, beat me by 4. Nice!

  • Custom User Avatar

    I'm all for "fix the bug" type katas, but usually bugs arise from expecting a certain result and being greeted with something seemingly random instead. I don't think I've ever gotten myself into a situation outside of this kata where I needed to debug code to find a result I didn't even know I was looking for. This would've been a lot better if the description was clear on what the function should return rather than leaving us to wonder why we even started it in the first place.

  • Custom User Avatar

    I would reinforce that the goal of the program is to find denominational change rather than numerical change. Maybe add a specific example to clarify further. Something like:

    "Be sure to count change by denomination. For example [25, 25, 100] will result in 'NO' because you cannot make 75 with 2 25 dollar bills"

    Or you could always extend your current example explanation to say:

    "NO. Vasya will not have the right combination of bills to give change for 100 dollars"

  • Custom User Avatar

    I'm completely aware of the logic and the math associated with the second interpretation, hence why I actually laid it out to show the expected outcome in my initial question. What I'm saying is it needs to be clarified in the description whether it is to be programmed via denomination or numerical value. Many times the 'logical assumption' has been completely thrown out the window when it comes to challenges on codewars, which means every challenge should lay out exactly what it is asking for, not expecting the coder to make an assumption. It seems to be an issue that a few people are misunderstanding as they try to work it out, myself included.

  • Custom User Avatar

    Thanks for clarifying, but that statement in no way specifies which of the two senarios would play out. I interpreted that statement as "you don't have to worry about 5 dollar denominations or 10 dollar denominations" not "count bills instead of numerical value"

    So... it is an issue and leads to lots of misunderstanding when testing, as it seems to have based on the 'suggestions' tab that I just read.

  • Custom User Avatar

    Another issue: is the change to be given back per numerical value or per each received dollar bill? For example:

    [25, 25, 100]

    The above would evaluate 'YES' if you were counting only numerical value. Starting is $0, then you have $25, then you have $50, then you have $75 (from the $25 from the 100) and you give back $75 as change. Your final total is $0.

    The returned log would be:
    0
    25
    50
    0
    'YES'

    The above would also evaluate as 'NO' if you were counting actual bills. Starting is $0, then you have a $25 bill, then you have 2 $25 bills, but when the guy with the $100 bill comes in, you can't break it with your current bill set, therefore, you can't give him his change of $75.

    The returned log would be:
    0
    25 - 1
    25 - 2
    'NO'

  • Custom User Avatar

    Had another attempt but couldn't get my ternary operator to work so I defaulted to an if statement. Found out that I forgot to put a return statment before the ternary operator.. oops

  • Default User Avatar

    Not sure if this was supposed to happen (this is my first "lesson") but the example script seems to be incorrect as well.