Solve tiling problem