Ad
  • Custom 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?

  • Custom User Avatar

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

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

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

  • Custom User Avatar

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

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

  • Custom User Avatar

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

  • Custom User Avatar

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

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

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

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

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

  • Custom User Avatar

    Fixed now. Thanks.

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

  • Custom User Avatar

    Thanks for doing this.

  • Loading more items...