Your program should determine the area of the space where the two rectangles overlap, and then output the number of times this overlapping region can fit into the first rectangles. coderbyte code example
Example: check if two rectangles overlap javascript canvas
// Where left, right, top and bottom are essentially edges
if (a.left >= b.right || a.top >= b.bottom ||
a.right <= b.left || a.bottom <= b.top)
{
// no overlap
}
else
{
// overlap
}