Ad
  • Custom User Avatar

    More than 2,000 people have passed this; are you sure you're not modifying the input in some way?

  • Default User Avatar

    I am using Java. I started to suspect that the name "diagonal" would suggest that the pixels were intended to be
    8,7
    7,8
    with obvious outputs. In any case, I paused working on this (very cool) problem because I suspect tests to be faulty.
    Too bad we can't see the tests; they wouldn't be spoilers really, as anybody can try to manually figure out
    the results on paper before ensuring that the algorithm gets the same results.

  • Default User Avatar

    You have the correct output for the example you gave. Which programming language are you using?

  • Default User Avatar

    My code fails the simple "diagonal" test which gets pixel data similar to

    8, 8,
    7, 8

    My output is [0,1,3] for color 8, and [2] for color 7.
    Why would the test fail on this trivial case?

  • Default User Avatar

    Static methods are OK for MT -- only static state creates a problem

  • Default User Avatar
  • Default User Avatar

    This is confusing in this problem but the starting point is in cartesian coordinates where 0,0 is the lower left corner; you are likely staring in the wrong place -- your output doesn't even put a 1 at (2,2) cartesian.

  • Default User Avatar

    complain to the original author, then, not me. ;)

  • Default User Avatar

    This problem has a "solution" by the author, cryptic code, and buggy.
    It produces results that for some values of size are wrong
    and will never match our correct solutions.

  • Default User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Default User Avatar

    I wouldn't call it "invalid". And the torus interpretation does not make much sense either.
    As it is, I claim this is not a great problem, at some point ROI is too small
    and we are fighting to get some unknown tests to run, benefitting little.

  • Default User Avatar

    Errr... I didn't think about that this way but, effectively, you could consider the example with a torus approach. But that's not the case, actually: in fact, if the starting point isn't surrounded by 1 on all sides (without wrapping on the other side of the grid), you have to considere the grid "invalid" and fill it with ones. I'll update the description so that it's clearer.

  • Default User Avatar

    in the test testFillIncompleteLoop there is a string of 1's which divides the 0's into 2 disjoint sets. I believed that both these 1's and the boundaries of the rectangle itself are borders for any propagation of 1's. That's how pixel color filling algorithms would behave.
    Are you saying that this rectangle is to be effectively treated as a torus?

  • Default User Avatar

    the starting point isn't surrounded on ALL sides, that's why. ;)

  • Default User Avatar

    The example with start at (6,4) "incomplete loop" seems to have the starting point actually surrounded with 1's prohibiting flow of 1's to the whole area. Am I missing something?

  • Loading more items...