Earn extra honor and gain new allies!
Honor is earned for each new codewarrior who joins.
Learn more
  • This comment is hidden because it contains spoiler information about the solution

  • How is 200 an unusual denomination?

    Okay, now I see it explicitly mentions 200 dollar bills. Sorry for the noise.

  • The following isn't true

    and assuming the ATM always has enough money to satisfy a withdrawal on any amount

    Because you forgot this part:

    or output -1 if it is impossible.

    About your last two points:

    I saw a comment where there are test cases greather than 1500, so correct either the test cases or the problem statement

    Removed some sample tests in a couple languages where n was 5000, the final tests seemed ok.

    Consider removing 200 from the denominations, as there is no such thing as a $200 bill; or make it in a fictional currency instead of dollars.

    You could use Argentine Peso, we have all those notes/bills, including the 200 one.

    The kata's author seems active, so I'll let him handle the description changes.

  • I don't understand this kata...

    There is enough money available on ATM in nominal value 10, 20, 50, 100, 200 and 500 dollars

    Is this saying the ATM contains bills (bank notes) in the denominations 10, 20, 50, 100, 200, 500 ?
    (200 is unusual as a denomination)

    You are given money in nominal value of n with 1<=n<=1500

    I am given money? In (American) English this implies that I have this money, so the only sensible thing would be to deposit it in the ATM, but that's clearly not what the kata is about.

    Try to find minimal number of notes that must be used to repay in dollars

    "repay" is definitely the wrong word to use here, as "repay" again implies that I have some money which I have to give to someone else (again, deposit in the ATM)
    If this is in dollars it should mention dollars earlier.

    If this kata is what I think it is (I haven't looked beyond the Description yet), this is about withdrawing money from the ATM. If that's the case I suggest rephrasing the problem more like the following:

    Given an ATM which contains bills/notes in the denominations 10, 20, 50, 100, 200, and 500 dollars,
    and assuming the ATM always has enough money to satisfy a withdrawal on any amount,
    find the minimal number of notes/bills that must be dispensed to pay out a withdrawal of 'n' where 1<=n<=1500

    • I saw a comment where there are test cases greather than 1500, so correct either the test cases or the problem statement
    • Consider removing 200 from the denominations, as there is no such thing as a $200 bill; or make it in a fictional currency instead of dollars.

  • Add this test to the sample tests, the error in your code will become evident:

    Test.assertEquals(solve(500), 1, "Wrong result for 500");
    
  • Thanks for the reply! I fixed the code by moving notesNeeded above for(var i...) but it still couldn't work. What is it about my code that's conceptually wrong? Thank you!

  • Check where you initialize notesNeeded.

  • This comment is hidden because it contains spoiler information about the solution

  • Seems approved

  • F# translation for approval at here

  • Must have been a server issue (and a long time ago...)

  • Hi there! It's a good kata but your description should be fixed — You are given money in nominal value of n with 1<=n<=1500.
    Range is wrong: n can be more than 1500 according to your test cases.

  • imo 2 hard 4 kyu7

  • I made it py3 compatible.

  • Approved with 7kyu, consider how old this kata is and it seems to be a beginner level task
    Please let me know if it should be assigned with 6kyu

  • Loading more items...