Find if the given size of the rectangle fits on the rectangle

46 Views Asked by At

Given a rectangle of size row = 3 and col = 2 which are occupied by other rectangles as in figure. enter image description here

The shaded region in green are occupied.

Now what I want to find is, if a rectangle of size (p = 2 and q = 1) or (p = 2 and q=2) can be placed on the empty slots of the rectangle without using any iterations.

enter image description here