Ad
  • Default User Avatar

    Friendship is commutative. (The description doesn't explicitly say this, but I think it's clear from the example given, which has Harry/Ron but not Ron/Harry.)

    Can you post the test case (the first few lines of it, at least) that produced the strange behaviour?

  • Default User Avatar

    That's true, but there is no better way to do it, short of resorting to a higher-precision floating-point type.

  • Default User Avatar

    You are taking a suboptimal path around the circle with centre at (2.83323324984,-1.17841666332). The path above and to the right of this circle is shorter.

  • 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

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

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

  • Default User Avatar

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

  • Default User Avatar

    Here's the relevant part of the input again. Cells X and Y both have colour 5.

    6 6 5 5 5 5
    5 5 5 5 5 5
    5 5 X Y 5 5
    6 6 5 5 5 5
    6 6 5 5 5 5
    6 6 5 5 5 5
    

    Cell Y has depth 3, but the depth of cell X is only 2 (one step down and one step left get you to a differently-coloured cell). So, X isn't part of the solution.

  • Default User Avatar

    By "completely trivial" do you mean that the constructors are unnecessary? If so, then yes: they won't be used in most solutions.

  • Default User Avatar

    The Wikipedia article on OCR-A is fairly detailed. If you want the TrueType font file, it can be downloaded for free from fontzone.com.

  • Default User Avatar

    The kata doesn't have a built-in way to visualize the images. The idea is that you should code your own visualization; consider it part of the challenge.

  • Default User Avatar

    Fixed now. Thanks.

  • Default User Avatar

    Do you still have the solution point you found for this test case? Please post it here if so (3 coordinates, each printed out to 20 decimal places).

    My apologies for not responding at the time; sometimes life has to take precedence over Codewars.

  • Default User Avatar

    Thanks for doing this.

  • Loading more items...