Ad
  • Default User Avatar

    ? my algorithm is pretty fast, as fast as a function that returns can get, I am using inline asm to zero 8 bytes at a time instead of 1 in a mapping, everything else is just c and posix

  • Default User Avatar

    If you think you need inline assembly for this kata, you are probably using an inefficient method. Micro-optimizing a bad algorithm is usually not worth it; try coming up with a better one instead.

  • Default User Avatar

    I am not putting up with clang, offer an actual C compiler that allows you to use inline assembly like G(od)CC.

  • Custom User Avatar

    Great kata! Touches a couple of side problems. I learned something.

  • Default User Avatar

    It'll feel good when you beat it though. :)

  • Default User Avatar

    this one is an absolute beast. it has kicked me in the pants at least five times now, causing me to scrap refactoring and start fresh again and again. i wish i had to mark this comment as including spoiler content lol. but it's just a note of desperation.

  • Default User Avatar

    Someone should rewrite the description of this kata. I see many complaints below pointing out that the algorithm is incompletely specified.

    This is what the description should have said:

    Choose any two array elements X[i] and X[j] with X[i] > X[j]. Set X[i] = X[i] - X[j].

    Repeat until no more subtractions are possible (because all array elements are equal).

    It can be shown that whenever there is more than one possible choice of the pair i,j, it doesn't matter which pair you choose: the answer will be the same in the end.

  • Default User Avatar

    Fixed - a more detailed description of the input is now included.

  • Custom User Avatar

    Hi,

    The description doesn't acutally warn the user about the real structure of the input stirng: for instance, there is a trailing new line.

    Cheers

  • Default User Avatar

    That's intentional. For this kata, you have to write an entire class from scratch.

  • Custom User Avatar

    Language: C++
    Initial solution are completely empty and in turn generates errors.

  • Custom User Avatar

    Yes. The rule of zero is a good practice.

  • Default User Avatar

    first solution O(N^4), TLE;
    second solution O(N^2), TLE;
    third solution O(N), pass!
    amazing kata!

  • Default User Avatar

    I uhm.. decided to write a bunch of for-loops in haskell

    It's transcribed from python. I've serialized and compared test cases from both with a small handful of seeds. Haven't touched instructions, I suppose it could say something haskell-specific on the input but I wasn't feeling inspired.

  • Default User Avatar

    Thanks, for some reason I was assuming straight directions only.

  • Loading more items...