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.
For the future please mention the language you are solving in. There was a bug in the TypeScript random test case generation. Now only positive numbers will be generated.
Approved.
Kata is unbalanced between languages. Brute-force works easily in JS while it times out in Python (yeah because Python slow, a big test case runs in under 50 ms in JS while the same takes more than 2 seconds in Python).
For some reason the solution was present in the sample tests. I have removed it now.
A last thing: Please add assertion messages also to Sample Tests, then I will approve.
20 is still too big but I tested and the refsol actually threats the number as unsigned so wrap-around would not be a problem.
Random tests only generate tests where recipe and available ingredients match.
10 ** 32
overflowslong
. Groovy seems to cut it off atLong.MAX_VALUE
though. Two randoms drawn from this range could overflowlong
easily and your refsolution will let them wrap around.returnsProduct
.Approved.
Fixed. Had an error in the random test generation, that's why there were no tests for the last column but the others could overflow.
What I don't like about this solution now is that I still use
+
twice.What would be the problem with 2 million ingredients? That this solution has no early return in case of 0? If you return any positive value, you have to look at all ingredients either way.
Approved.
Approved.
Please mark comments including solution code as Spoiler next time because they are visible on the dashboard.
Loading more items...