Ad
  • Default User Avatar
  • Custom User Avatar

    The C++ randomized tests are ridiculously more difficult than the Javascript ones. Here are a few randomized tests from the Javascript cases:

    money=2962, coins=[342, 381, 358, 400]
    money=0, coins=[14, 482, 58]
    money=1504, coins=[376]
    money=0, coins=[108, 358, 319, 439]
    

    and the madness that are the randomized C++ cases:

    money=45290, coins=[1, 2, 2052, 2414, 3758, 3768, 4685, 6607, 6852, 9886, 11599, 12309, 12537, 14983, 19645, 21142, 21952, 22199, 25886, 26096, 26608, 28288, 29523, 30689, 36574, 37546, 39867, 40640, 41033, 43250]
    money=71905, coins=[1, 2, 1091, 3875, 8351, 10746, 11519, 14011, 22480, 22954, 23537, 26308, 30694, 35073, 40862, 41930, 42306, 47965, 50558, 54438, 57510, 57864, 61605, 63530, 67173, 67536]
    money=71119, coins=[1, 2, 2473, 24198, 24931, 31298, 39847, 42517, 50857, 54231, 59625, 66036]
    

    I ended up implementing an optimization just for these 1, 2, big_number, ..., big_number cases, which funnily enough is enough to pass them (assuming that the rest of your code is somewhat efficient). Otherwise a recursive solution simply isn't performant enough.

  • Custom User Avatar

    This prob is my second dp prob and i gotta say tht these probs really make u think! I feel stupid each time i am working on one! Combinatorics and prog give headache problems, i tell ya!

  • Custom User Avatar

    I agree. The C++ tests are too hard. Much harder than the tests for other languages.

  • Custom User Avatar

    I translated the simple C solution to Haskell, and it easily passed the Haskell tests. Looks like the C++ tests are much harder than the tests for other languages.

  • Custom User Avatar

    The C++ tests are much tougher than e.g. the C tests. I just tried it: A simple C solution that easily passes the C tests times out on the C++ tests. A bit unfair, I'd say. Either the C tests are too easy, or the C++ tests are too hard. I don't know which...

  • Custom User Avatar

    The C++ tests are much tougher than e.g. the C tests. I just tried it: A simple C solution that easily passes the C tests times out on the C++ tests. A bit unfair, I'd say. Either the C tests are too easy, or the C++ tests are too hard. I don't know which...

  • Default User Avatar

    There is 1 way to get 0, and that is by having 0 coins.

  • Custom User Avatar

    Sorry @trashy_incel, this was the first time I opened an issue and I was running crazy and did not found out exactly what was happening. It seamed that for some reason, something was being cached from test to test, even though everything was instantiated inside the function, so the submit test set was giving different results on some tests. Most likely something on my side, but running out of options, decided to open an issue. I'll remember to post more information next time, and to come back after completion (after getting all tests to pass, I stumbled upon timeout, so had to rethink on a faster solution)

  • Default User Avatar
    • you solved the kata and did not come back to close your issue / add more information, that's not very nice
    • you give no evidence anwyays (input/output/expected and why you think it's incorrect ?)
  • Custom User Avatar

    The "Attempt" tests set are giving awkward results.
    I tried copying one failing test to the "Test" set, and it gives the correct result there !
    I tried copying the algorithm and the input to Python Tutor, and it also works correctly giving the correct result !
    I have no idea why the attempt set is giving different results.

  • Default User Avatar

    There is one way to make change for 0, which is to give back 0.

  • Default User Avatar

    4th test, why on earth is it 1 and not 0?
    count_change(0, [1,2]) # => 1
    Am I missing something?

  • Custom User Avatar

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

  • Custom User Avatar

    The tests should be changed and/or lessened, or the recursion tag should be removed from the question.
    I timed out the first time I tried a recursive solution in python and the second time I got an error because I exceeded the maximum recursion depth (the money was over 5000 and there was a coin with value 1).

  • Loading more items...