### 13.2. Graphical and Spatial Problems

Diagramming and visualization are the keys to solving the brainteasers that follow.

#### 13.2.1. Boat and Dock

NOTE

You are sitting in a small boat, holding the end of a rope. The other end of the rope is tied to the top of a nearby pier, such that it is higher above the water than your end of the rope. You pull on the rope, causing your boat to move toward the pier, stopping directly underneath the pier. As you pull on the rope, which of the following is faster: the speed the boat moves across the water or the speed the rope moves through your hands?

You should begin this problem by drawing a diagram, both to ensure you understand the scenario and to get you started on the solution. The edge of the pier, the water, and the rope form the legs of a right triangle, as shown in Figure 13-1. To facilitate further discussion, these segments are labeled A, B, and C, respectively.

##### Figure 13.1. Figure 13-1

Here you have something familiar, but with an unusual twist. You've probably worked with right triangles ad nauseum in your math classes, but those are static figures — this triangle is collapsing. Be wary of this difference. Although it seems minor, it may be enough to make the wrong answer seem intuitively correct.

Given your experience with right triangles, you may decide to attack this problem mathematically. You need to determine whether side ...

Get Programming Interviews Exposed: Secrets to Landing Your Next Job, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.