Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
More than 2,000 people have passed this; are you sure you're not modifying the input in some way?
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.
You have the correct output for the example you gave. Which programming language are you using?
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?
Static methods are OK for MT -- only static state creates a problem
Why 8?
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.
complain to the original author, then, not me. ;)
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.
This comment is hidden because it contains spoiler information about the solution
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.
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.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?
the starting point isn't surrounded on ALL sides, that's why. ;)
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...