2

Imagine you have a list of Tetrominos (tetris shapes) that cannot rotate (19 possibilities) and you have to arrange them to make the smallest square.

For example, given:

A...
A...
A...
A...

BB..
.B..
.B..
....

.C..
.C..
CC..
....

The result should be:

A.BB
A.CB
A.CB
ACC.

as this is the smallest square that can accommodate the three inputs.

I tried to figure it out by myself but now I'm a bit confused.

Do I need to try with a certain size of square, try every possibilities and then increase that square until it's possible to place every Tetromino or is there another way?

Mohit Jain
  • 30,259
  • 8
  • 73
  • 100
Charlon
  • 363
  • 2
  • 16
  • 2
    Algorithmic aspects of Tetris are in fact subject of advanced academic study, for instance [here](http://erikdemaine.org/papers/Tetris_TR2002/paper.pdf). It seems to be rather hard. – Codor Dec 09 '15 at 08:41
  • "*arrange them to make the smallest square*" - do you mean "*fits within the smallest possible bounds*"? Because a square of length *n* will (at best) fit *n* ^ 2 / 4 Tetrominos. – Wai Ha Lee Dec 09 '15 at 09:03

0 Answers0