![]() |
VOOZH | about |
Given a special Jigsaw puzzle consisting of N rows and M columns all identical pieces. Every piece has three tabs and one blank. The task is to check if the puzzle is solvable by placing the pieces in such a way that the tab of one piece fits perfectly into a blank of other piece.
: Rotate and Translate the pieces to solve the puzzle.
Input: N = 2, M = 2
Output: YesInput: N = 1, M = 3
Output: Yes
The key observation in the problem is that:
Below is the implementation of the above approach:
YES
Time Complexity: O(1)
Auxiliary Space: O(1)