mmozeikoI believe this is NP hard problem. There is no efficient algorithm. I would do recursive backtracking that tries all combinations. Try googling "Polyomino solver" or something similar: https://en.wikipedia.org/wiki/Polyomino