0

You are given a special jigsaw puzzle consisting of nā‹…m identical pieces. Every piece has three tabs and one blank, as pictured below.

The jigsaw puzzle is considered solved if the following conditions hold: 1. The pieces are arranged into a grid with n rows and m columns. 2. For any two pieces that share an edge in the grid, a tab of one piece fits perfectly into a blank of the other piece.

We can have blank or tab at the perimeter.image of single piece

I couldn't figure out what to do even after looking into lots of articles. This was asked as a programming problem and I seem to have stuck.

  • 1
    Welcome to MSE. You'll get a lot more help, and fewer votes to close, if you show that you have made a real effort to solve the problem yourself. What are your thoughts? What have you tried? How far did you get? Where are you stuck? This question is likely to be closed if you don't add more context. Please respond by editing the question body. Many people browsing questions will vote to close without reading the comments. – saulspatz May 06 '20 at 16:24
  • Hint: In an n by m grid arrangement, how many pieces are there? How many blanks are there? How many shared edges are there? – Jaap Scherphuis May 07 '20 at 09:25

0 Answers0