Sie sind auf Seite 1von 2

An Interview Question from Microsoft

From time to time technical interviews may contain puzzles to assess a candidates
ability to think through a problem from first principles. The dog and duck problem is
a good sample. Supposedly this problem was given in a Microsoft interview:
https://sbjoshi.wordpress.com/2008/12/26/puzzle-death-defying-duck/ There are
other variations of this problem such as this one that asks for how fast the dog must
need to run in comparison to how fast the duck can swim in order to keep the duck
from flying off: https://fivethirtyeight.com/features/will-the-dog-catch-the-duck/
This problem may also appear in a high school physics class as I came across this
problem in a physics problems book from China.
There are two basics required to solve problems of this kind:
1. Since arc length is related to radius by arc length = radius * angular
extension of the arc, it follows that tangential velocity = radius * angular
velocity
2. Time taken to travel a distance is given by time = distance / velocity
Here is how I go about solving the interview problem. Suppose the dogs speed is
V1; ducks speed V2. The ducks strategy can start moving along a small circle such
that its angular velocity is always larger than the dogs angular velocity around the
pond (V1/R). Over time with patience and intelligent strategy, the duck can
eventually build up its advantage to be closer to the shore and circle at radius r with
the dog at diagonally opposite position as shown in the figure below.

The duck will need to swim a distance of (R-r) to reach the shore to fly away while
the dog needs to run a distance of pi * R to catch the duck. The duck will be able to
fly away if it reaches the shore sooner than the dog getting there:
Rr R

V2 V1

After simplification, the above equation gives

V2
(
r R 1
V1 )

In Microsofts question, V 1=4 V 2 . Hence (
r R 1
4 ) , i.e. r 0.2146 R . For

R
example, r= would make the interviewer happy.
4

Regarding the variation about how fast the dog must be able to run to keep the
duck from escaping, one can go about thinking that in the following way. If the duck
r
is circling at radius r with angular velocity V 2 , the dogs angular velocity
needs be faster than the ducks to keep the duck from positioning itself diagonally

away from the dog. Hence the dogs speed must be V 1> ( Rr ) V 2 .

Unless one is well trained to solve puzzles, such interview questions would prove
too difficult under the time constraint and pressure of interviewing.

Das könnte Ihnen auch gefallen