Re: Clarification sought for specification of the Polygon Area Calculator.
Question: What method is required to solve how many rectangles will “fit” ?
The spec requires to know how many times (say) rectangle2 will
fit into rectangle1 . Rotation not permitted. (See end for full text of spec).
Folks seem to be solving this with (essentially):
Fits = rectangle1_Area / rectangle2_Area
But I don’t see how that works.
Say rectangle1 has area 100 square units and rectangle2 has area 25 square units.
Fits = 100 / 25 = 4 right ?
But what if rectangle1 is 1100 and rectangle2 = 55. Then fit = 0.
I know how to solve this problem but do I have to ?
It’s not simple and I’d like to know what the testers require.
Many thanks.
Here is the relevant part of the spec:
-
get_amount_inside
: Takes another shape (square or rectangle) as an argument. Returns the number of times the passed in shape could fit inside the shape (with no rotations). For instance, a rectangle with a width of 4 and a height of 8 could fit in two squares with sides of 4.