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.
Finding active users is not the main problem in beta process. But I agree with you, I've discontinued kata authoring myself because I'm fed up.
Hi, nice series of katas. Learned a lot by solving your katas. Thank you!
While my approach passes the standard tests it fails often in the random tests. The test suite claims that for example for the difference of
A-B = [9, 12, 1, 1, 77, 34, 1, 1, 0, 73, 20, 25, 60, 42, 28, 24, 10, 11, 30, 35, 36, 0, 33, 18, 51, 26, 0, 51, 13, 25, 13, 10, 49, 8, 5, 25, 64, 12, 42, 1, 13, 57, 43, 0, 1, 39, 12, 10, 18, 1, 27, 1, 31, 7, 71, 61, 27, 38, 15, 42, 1, 11]
the optimal solution is 21 thieves fork=77
.As far as I can see from solving this by hand and with a binary division and greedy approach it can be achieved with 20 thieves without breaking the rules. This also corresponds to the heuristic for the lower bound of the
sum(differences)/k
which is 19.5. Am I missing something or are the random tests only sometimes using the optimal solution as K01egA hinted at?Hi! 💛💙
Right now I’m feeling inspired to create some more challenging SQL katas (around 4–5 kyu), but as you know, it’s often hard to find enough active reviewers on Codewars to help move them out of beta.
If you ever have a time to solve them and leave some feedback, I'd be truly grateful 🙏
long way: don't do that, you'll run into this "bug" and it's way more work than needed.
controversial: huh?
I'm also planning on solving it the long way, only adding hydrogens as last step, until valence is met. Apparently, in chemistry, adding additional hydrogens when valence is met, is very rare and controversial. Is this a bug or a feature in the kata?
Toy tests fails with
ValueError: max() arg is an empty sequence
if solution is differently rotated. E.g. "AACGTTCG" for first test.This problem can be reduced to the set cover problem, which is NP-hard, looking at size of tests I can assume that reference solution uses some king of greedy approach, which do not guaranty optimal solution.
Example A = [3, 8, 8, 6, 7], B = [2, 2, 3, 5, 6], k = 6. My solution is 3. First thief can take from jars 1 and 4 second from 2, third from 3 and 5
very elegant (haskellish) solution
Approved
Approved. 7kyu average rank
I totally understand your frustration! I've spent days trying to fix bugs myself. It's tough when a formula just won't behave. Turns out I was the one with the bug—guess I need to read the instructions too! I'm glad you figured it out in the end. Great job!
I tried to reduce my code for days, not understanding why my formula was wrong!
Loading more items...