This is a
solution to
problem 5 on the
hard interview questions node. If you have not read the
question, the
following will make no
sense to you:
Here's a hint: what does every line that cuts a rectangle in half have in common (something simple)? If you want the full solution, read on:
Every line that cuts a rectangle in half passes through the center of the rectangle. There are infinite such lines for every rectangle. However, there is exactly one line that passes through the centers of both rectangles, the cake and the hole in it -- that is, of course, unless they share a common center. This line divides both rectangles exactly in half, and this is the line along which you make the cut.