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.
My solution uses the intended two-pass method; now that you've solved the kata you can take a look at it. Both algorithms are O(number of pixels).
This comment is hidden because it contains spoiler information about the solution
Thanks for authoring such a great challenge! After a few days of working on this kata, a fun mix of mathematical and programming insight finally got me a rather efficient solution!