Fog Creek Software
Discussion Board




cars on the road - solution

I think this problem can be solved as a geometric distribution:

p = probability of seeing a car in one 5-minute time interval
q = probability of not seeing a car in one 5-minute time interval
where p = 1 – q

p(y<=4) = probability of seeing a car in four 5-minute time intervals (20 minutes)

Find p given that p(y<=4) = 609/625

p(y<=4) = p(1) + p(2) + p(3) + p(4)
              = q^0*p + q^1*p + q^2*p + q^3*p
              = p*(q^0 + q^1 + q^2 + q^3)
              = (1 - q)*(q^0 + q^1 + q^2 + q^3)
              = (q^0 + q^1 + q^2 + q^3) –
                (q^1 + q^2 + q^3 + q^4)
              = 1 - q^4
              = 609/625

1 – q^4 = 609/625
q^4 = 1 – 609/625 = 16/625
q = 2/5
p = 1 - q = 1 - 2/5 = 3/5

CM
Wednesday, November 06, 2002

That's a good solution, but to nitpick a bit - probability is too high to assume there is always exactly one (or zero) car within 20 min, which makes final result to be "p>=3/5"

Although it's probably too complicated for usual technical interview to get that far into math.

DK
Tuesday, December 17, 2002

*  Recent Topics

*  Fog Creek Home