Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
duplicate of this issue
The C++ randomized tests are ridiculously more difficult than the Javascript ones. Here are a few randomized tests from the Javascript cases:
and the madness that are the randomized C++ cases:
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.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!
I agree. The C++ tests are too hard. Much harder than the tests for other languages.
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.
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...
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...
There is 1 way to get 0, and that is by having 0 coins.
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)
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.
There is one way to make change for
0
, which is to give back0
.4th test, why on earth is it 1 and not 0?
count_change(0, [1,2]) # => 1
Am I missing something?
This comment is hidden because it contains spoiler information about the solution
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...