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.
I think that one of them is clearly wrong, to pass it I hardcoded the specific test case.
This killed the joy of seeing the K-Means algorithm decoding that last message.
Thanks!
Polaris, did you discover something in particular that made you solve this problem?
const has been added to (hopefully) prevent (at least some) future confusion ;)
It's not easy to answer your question without knowing a) language you attempted (I presume C?), and b) what you tried to actually do with the input string? But I guess you are puzzled by the fact that in C you could not modify contents of the buffer pointed by
strng
, right? If so, that's becausestrng
points to a string literal (literal value of"bsjq"
or"XjYABhR"
), which are stored in read-only memory and cannot be modified even if they are pointed by a pointer to non-const char.There is a similar comment below. The question description is indeed outdated.
Use spoiler flag next time, otherwise, everybody can see what you wrote in the homepage.
raising an issue and immediately stating that you're uncertain as to whether it is in fact an issue is not a good way to raise an issue, amirite. 239 coders have solved the kata. it does not require some magic solution ~ my solution is prety basic, really. But if you DO find a problem, please raise that as an issue, provide some concrete evidence, and I'll be more than happy to have a look, thanks.
I abandoned this kata after spending a lot of time with it. While I see a number of people have solved it in C, the problems appearing with the random-puzzle makes no sense to me. I too believe there is an issue with the C implementation.
I do not 'mutate' the input.
The warning not to assume data are "constant after instantiation" means that you shouldn't assume the image data has anything in common with what it was in previous calls to the
central_pixels
function. Whether you're in danger of making this assumption depends a bit on the language you're working in: it doesn't make much sense in C, but might be more natural for a conventional Python programmer. See the discussion below following the comment by Blind4Basics.You aren't using the return value from
realloc
. To change the size of theresult
array, you need something likeresult.values = realloc(result.values, ... )
Also, note that the definition of a pixel's depth (the minimal number of steps required to reach a pixel of another colour or the edge of the image) does not require the steps to all be in the same direction.
Do not mutate the input!! That's what happens!
For the string given in your edit:
My reference solution always returns a string that mimics an array of two arrays; in this case it returns:
At last I will say the same thing @Steffan153 told you for the k-prime kata: many people (amongst them "smart" people) have passed the kata so one can be quite sure that the problem doesn't come from the kata but certainly from your code. I see you are new at CW and I am sorry that you have problems.
A good 50 people have solved it in C, so it is probably a code issue.
Don't mutate the input!!!
C translator here ~ number one thing to do is to very carefully examine the sample tests provided and what's expected by (EACH) of them, good luck