Ad
  • Default User Avatar

    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.

  • Default User Avatar
  • Default User Avatar

    Polaris, did you discover something in particular that made you solve this problem?

  • Custom User Avatar

    const has been added to (hopefully) prevent (at least some) future confusion ;)

  • Custom User Avatar

    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 because strng 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.

  • Custom User Avatar

    There is a similar comment below. The question description is indeed outdated.

  • Custom User Avatar

    Use spoiler flag next time, otherwise, everybody can see what you wrote in the homepage.

  • Custom User Avatar

    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.

  • Custom User Avatar

    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.

  • Default User Avatar

    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.

  • Default User Avatar

    You aren't using the return value from realloc. To change the size of the result array, you need something like

    result.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.

  • Custom User Avatar

    Do not mutate the input!! That's what happens!

  • Default User Avatar

    For the string given in your edit:

    • you can't have
    Error. Expected 
    {{13, 6, 1831}, 
     but got 
    {{13, 6, 1831}, {13, 12, 12235}}
    

    My reference solution always returns a string that mimics an array of two arrays; in this case it returns:

    "{{20, 0, 12719}, {20, 4, 17606}}"
    
    • The space at the end of the string doesn't bring any problem. I don't think it is the cause of your failing. It's up to your code to take care of that. The description says nothing about spaces in the given string.

    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.

  • Custom User Avatar

    A good 50 people have solved it in C, so it is probably a code issue.
    Don't mutate the input!!!

  • Default User Avatar

    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