The easiest algorithm is brute force. We prepare a 5 by 12 matrix (or 6 by 10. If 0 is written in the cell, it means no one is busy, if the number is greater than zero, it means that it belongs to the figure with the given number. And now, BALAX, we take the next figure and try to put it in each cell in four positions, if we don’t attach ourselves, we take the next one. If we’ve attached, try the next figure, if all the figures are used, there was a solution.
The way looks bad. Figures 48 (12 times 4), 60 cells. Each figure can theoretically be in any cell (theoretically). therefore, we get 48 to 60 degrees (and this is about 7 to 10 to 100). Therefore, the following improvements should be applied - do not put a new figure in such a cage that it will not have a common border with existing figures (the very first one necessarily occupies the corner cage). For the first figure there will be a maximum of 4 options, and for the subsequent ones - 10-15 (you need to sit and clarify). And this will give much less than 4 * (44 in 15) - that is, several hundred thousand. And it is already easy to sort out.
You can even a little better. Spread brute force into two parts. In the first part we try to collect the bottom 2 (3 or 4) lines. That is, do not try the options when the next figure is located above this line (if part of the figure sticks out - do not worry). And then, for each of the options found, look for a complete solution. Or even better - to find solutions where the collected areas do not intersect in figures. Accordingly, there will be a bottom and a top, and you will need to fill in the middle. If you fill no more than 3 lines, and a rectangle is 6 by 10, then there will be no overlap (this is easy to prove).
And for the rest - read the article on Habré .
PS The above is correct if we are talking about one-sided pentamino. If it is allowed to turn the figures, there will be more options.