Ad
  • Custom User Avatar
  • Custom User Avatar

    I'm having the same issue, for some reason the console.log shows that [1, 2, 5] is being passed as the coinDenominations. Only when I console.log it with nothing else on the function does it show as [1,2,5,10,20,50]

  • Custom User Avatar

    thank you for your help!

  • Custom User Avatar

    You have no test failed because your code crashes on performance tests, and tests abort as soon as it happens. Read the log to the end:

    STDERR
    FATAL ERROR: invalid array length Allocation failed - JavaScript heap out of memory
    Aborted (core dumped)
    
  • Custom User Avatar

    hello, this is my first time encountering this one, what does it mean if i passed all the test cases and have 0 failed test but it is not letting me submit. I checked the result and saw that the performance test is still red, what does it mean? thank you in advance

  • Custom User Avatar
  • Custom User Avatar

    I have an issue... i run my code on RunJS and there all the test cases pass fine but when i copy the same code and run the test here not passes all of them and with a console.log i see that here it works really weird. How can i do to solve this?

    Here in this test case: coinsNeeded(123,[1,2,5,10,20,50]) the console.log shows me that only uses to reduce the amount by 5...
    but in my RunJS its reduced properly as shown in the sample test (50+50+20+2+1). I will copy my code here for you to test it in diferrent places but idk if its correct doing that here. So i wait for a response to try to solve my problem. Thank you and have a good day

  • Custom User Avatar

    ( JS )

    Example tests: it("123 is 25+25+25+25+10+10+1+1", () => { is missing one + 1.

    There may be more.

  • Custom User Avatar

    voile thanks for your help <3 <3 <3

  • Custom User Avatar

    In fact this is kind of a duplicate, so, better to retire it probably?

  • Custom User Avatar

    The task stated by the kata is

    given a set of coin denominations determine the fewest number of coins required to add up to a given amount

    It didn't tell us to calculate the amount of coins as determined by a greedy algorithm. In fact both are incompatible, since a greedy algorithm is not a correct algorithm. So the description at it is right now is unacceptable.

  • Custom User Avatar

    Well, I guess the description is poorly written.

    Since this:

    All amounts given will be solvable.
    Be greedy...

    contradicts that.

    I guess the fix is either to change the description or rewrite the tests and reference solution...

  • Custom User Avatar

    It depends on what "solvable" means.

    Now because the description is still full of issues, it's like that right now. The whole description needs to be revamped, actually.

  • Custom User Avatar

    Isn't this just an inherent attribute of greedy algorithms? It seems like the point of the kata is to practice greedy algorithms, not necessarily to find a guaranteed optimal algorithm.
    The tests don't have such cases as your example for a reason, no?

  • Custom User Avatar

    The kata only guarantees that "all amounts given will be solvable" and "a greedy algorithm should be used", but does not guarantee that the solution can be reached via a greedy algorithm, e.g: 9 and [5,3].

  • Loading more items...