0

okay...i've got another wired counting problem, this time it's about rectangles!
gotta find the minimum number of lines to divide a rectangle into squares! i went for...ehh
well a dumb idea of cutting the max square off, and cutting the little ones recursively, but...
doesn't always work.
you're given the two dimensions of the rectangle...that's it. both are integers btw.

3
Contributors
5
Replies
6
Views
9 Years
Discussion Span
Last Post by dmanw100
0

Find a point that is as far in as the length of the height (assuming height < width). Then you have a square and a new rectangle. Repeat the procedure using the shortest side as the side of the new square you want to cut. Do this until S1 == S2.

0

but i need the minimum...that's not the minimum...try for example with dimensions 6*7...

0

How many squares are you supposed to build using your rectangle ?

For instance if the length is twice the width or vice versa, you'd be able to split the rectangle into 4 squares using 2 lines. And then you could keep splitting it making smaller and smaller squares ..

0

My method will return 8 squares. I don't know if I quite understand the output you want from 7*8? Give me an example of what squares you want to get...

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.