Programming Contest Question: Counting Polyominos

Posted by Martijn Courteaux on Stack Overflow See other posts from Stack Overflow or by Martijn Courteaux
Published on 2011-01-10T19:41:09Z Indexed on 2011/01/10 19:54 UTC
Read the original article Hit count: 233

Filed under:
|
|
|
|

Hi,

An example question for a programming contest was to write a program that finds out how much polyominos are possible with a given number of stones.

So for two stones (n = 2) there is only one polyominos:

XX

You might think this is a second solution:

X
X

But it isn't. The polyominos are not unique if you can rotate them.

So, for 4 stones (n = 4), there are 7 solutions:

X
X   XX   X    X     X   X
X   X    XX   X    XX   XX   XX
X   X    X    XX   X     X   XX

The application has to be able to find the solution for 1 <= n <=10

PS: Using the list of polyominos on Wikipedia isn't allowed ;)

EDIT: Of course the question is: How to do this in Java, C/C++, C#

© Stack Overflow or respective owner

Related posts about c#

Related posts about java