Minimum number of moves required to solve a Jigsaw Assembly Puzzle

You are given a jigsaw puzzle that contains n pieces. A “section” of the puzzle is a set of one or more pieces that have been connected to each other. A “move” consists of connecting two sections. Given that initially, all the pieces are separate, then what is the minimum number of moves in which the puzzle can be completed?


Let’s consider the above problem case-wise:

  1. Case n = 2: In this case, we only have to combine two pieces, which can be done in a single move. Hence, the total number of moves required is 1.

  2. Case n = 3: Here, we can first join any two pieces as required and then, we can add the final piece to the section. This results in the total number of 2 moves.

  3. Case n = 4: Just continuing from the last case, we can first combine two pieces, then combine the third one and finally, the fourth piece. The total number of moves required in this case is 3.

  4. For any value of n: Notice, the pattern building up in the previous 3 cases. We first solve the puzzle for (n-1) pieces and then finally add the last piece with 1 move.

    Let’s represent this mathematically:

         Let F(n) be the function denoting the minimum number of moves required to solve the puzzle, where n is the number of pieces we have initially. Then, we have \\* \Rightarrow               \hspace{30} F(n) = F(n-1) + 1 \\* \Rightarrow               \hspace{30} F(n) - F(n-1) = 1 \\* \Rightarrow               \hspace{30}$$\sum_{i=2}^{i=n}\hspace{5}(F(i) - F(i-1) = 1) \\* \Rightarrow               \hspace{30}$$\sum_{i=2}^{i=n}\hspace{5}(F(i) - F(i-1)) = $$\sum_{i=2}^{i=n}1 \\* \Rightarrow               \hspace{30}(F(n) - F(n-1) + (F(n-1) - F(n-2)) + ..... + (F(2) - F(1)) = n - 1 \\* \Rightarrow               \hspace{30} F(n) - F(1) = n - 1 \\* \Rightarrow               \hspace{30} F(n) - 0 = n - 1 (F(1) = 0, its\hspace{2}trivial) \\* \Rightarrow               \hspace{30} F(n) = n - 1 \\*

  5. Hence,

    The minimum number of moves required to solve n-piece jigsaw puzzle is (n-1)

    My Personal Notes arrow_drop_up

    Check out this Author's contributed articles.

    If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

    Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

    Article Tags :
    Practice Tags :


    Please write to us at to report any issue with the above content.