As an input i am giving 2D grid of 0´s with few -1 positions indicating places that can not be filled and blueprint of some shapes (as in Tetris game)
ex. of grid ex. of shapes
0 0 0 0 0 0 0 1 1 1 2 2 2 3 3
-1 0 0 0 0 0 0 1 2
-1 0 0 0 0 0 0 1
0 0 0 0 0 -1 0
0 0 0 -1 0 0 0
Algorithm should output the grid filled with given shapes always having to use all of them once I can rotate the shapes and i should always be given grid and shapes that is possible to fill. I looked into algorithms like flood fill algorithm but i do not really see a way of using it here. Is it possible to do it differently than brute forcing through?