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.

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.

Its confusing but post some code once you try it out.

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

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 ..

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...