Hacker News new | ask | show | jobs
by onos 1641 days ago
This was fun and simpler than I was anticipating: After first reading the problem statement I assumed we’d need to do some sort of search to get the connected clusters, but we see here the line to draw at any point is determined completely by local info. Neat!
1 comments

It is deterministic, though I am not sure if it gives one unique solution. In the example shown, there are many squares with white dots on one diagonal and black dots on the other; in these cases, it always seems to separate the white dots. (These are the cases liversage points out are ambiguous.) I guess that if you reversed the coloring, or used the alternatives for cases 5 and 10, the resulting partitioning would join the previously-white dots together.

Now I am wondering if you could use the alternative for case 5 or 10, but not both.