Back to General discussions forum
This is a fairly straightforward problem but it is worth the effort to find an efficient solution.
Clive, thanks a lot for the problem! Unrelated, but it reminds me of M.Gardner explaning agricultural experiments made in similar grid of patches (and application of "Greek-Latin" squares to them). Also it was surprising to learn of the word Quardrat which is exactly how "square" is called in slavic languages (e.g. Polish "Kwadrat").
Thank you! This finally gave me the motivation to implement a data structure that had been on my nice-to-have list for quite a while. And Quadrat literally translates as square in German as well.
Thanks, Clive - this is another great problem (although I do think I solved it differently from everybody else; does run in under a second, though).