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.
thanks !
lengthis explicitely initialized to an arbitrary nonzero value to prevent solutions that forget to initialize it (otherwise the memory could happen to contain zero every time). this is an implementation detail of the tests: output parameters should be considered uninitialized by the user.The kata does work in C, I was able to complete it just now.
I think you might have misunderstood slightly. In C,
lengthis an output parameter... you are supposed to write the length of your resulting array tolength, as well as return an array of that length from the function. Right now you’re treatinglengthas an input value, but it’s uninitialized, so malloc is allocating a garbage size and the writes cause undefined behavior. There are other issues with your solution as well, but that's a starting point. Edit: I just looked at the tests and found thatlengthactually is initialized by the tests (but not to the correct value, you have to calculate that yourself), so it doesn't make your code do anything too wacky, but the point still stands.Kata doesn't work in C, I ran a test, and it turns out my array is identical to what I expected, but Kata still says it's incorrect
Java translation
C translation (author gone)
fixed there
Really nice kata of the series to begin with.
I was wondering the exact thing.
Enabled in this fork
Rust translate
Solved this in JavaScript and then tried it in Python. I cant get it to work even after copying the solutions into my editor. Something about... something has no value attribute. My input was something like this..{'a': 1, 'b': 2, 'c': 3}. A few examples with input and output would have been helpful.
Approved
Python updated test framework
Loading more items...