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.
This is the pattern of the dynamic programming
Awesome code using dynamic programming
Oh ok, my mind was stuck on a way to use 1 and 2 to make 0.
But i get it now, thanks !
If you have to return nothing, there is one way to do that, right?
In the other case, you can't return 11, that's why you need to return 0.
I don't understand why countChange(0, [1, 2]) should be "1".
Like countChange(11, [5, 7]), if there is no way to use any coin, it's just 0 ?!
What is the change you use to make "1" out of countChange(0, [1, 2]) ? 1 ? 2 ?
Java Translation
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)
Loading more items...