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.
Just because your solution doesn't work in all test cases. Try to figure out what is going wrong.
I don't think so. Your solution seems perfect to me. Have you got any problem in passing tests?
Why?
Simple. Round and floor functions aren't the same. For example, round(1.7) = 2, but floor(1.7) = 1.
Since the empty string has no characters, the definition of the problem is ok.
The percentage is a positive number, so the population is always increasing.
Your code is returning 3, but it should return 4 instead.
char *words_array[]
is an array of strings that you have to fill with the words in the input stringwords
.words_array
is an output parameter that does not initially contain anything meaningful. You have to allocate memory on the heap (malloc()
& friends) for each word.words_array
itself is necesarily already allocated, otherwise it would be impossible to pass it as a parameter.I am trying to solve this kata in C, but for me it is not clear what I must allocate: words? words_array? or both? Can anyone help me with this?
Thanks for the hint. I was allocating with malloc. I switched to calloc and the bug was fixed.
Your code does not NULL-terminate your output, so that causes undefined behavior outside of your function.
I think there is a problem with the random tests. I'm coding in C. Take a look at what I got.
n = 9
Submitted: dokuz
Expected: �adokuz
Any idea about what is going on here?
Thanks.
Hi, whene I understand your code I really get blow mind with how your solution it's simple and also get the task done cause the kata looks really difficult .
What "2" are you talking about?
Loading more items...