# Quantitative Interview questions and answers

#### goodstudent

7. There are 14 identical-looking balls. 13 of them have the same weight while one of them is heavier than the rest. What is the minimum times you can weight to identify the heaviest ball ? How do you generalize for n balls ?
Answer: With 3 weights, I can identify the heaviest ball. For n balls, I can identify the heaviest ball after x times where x is the largest integer such that $$2^x<=n$$

But what if n = 8. It would say that it needs 3 weighs, but it can be done with 2.
A subway station. There are trains going in each direction. For each direction there is a train every 3 min. Stops are fast, say 1 sec. One direction is to work, the other one is clubbing.
A blondie decided to do the following: go to the station, wait for the first train and take it.
After some time she realized she goes to work 2x more than clubbing. How come?

She works at the club

#### APalley

A very interesting probability question:

A city is 1-sq. mile by 1-sq. mile, with city hall at the origin. The odd thing about this city is that people can only walk in straight lines and no diagonals. If houses are uniformly distributed throughout the city, what is the expected walking distance to city hall?
Here is how I approached this:
The minute hand will run a full circle in 1 hour. By then, the hour hand will be at 1. Then the minute hand will run pass 1 (meaning 5 minutes) and it will meet the hour hand somewhere after that.
This will give me a quick estimate of when they meet. The first time they meet is sometime after 1 hour 5 minutes. To find the exact time is simple calculation:
The distant the minute hand travels in t seconds will be the sum of 1 full circle and the distant the hour hand travels in t seconds. Solve for t to find t= 3927.2727...=1 hour 5 minutes 27.27 seconds

Another possible approach would be to just sum the infinite series:

60$$\sum_{n=0}^\infty (1/12)^n$$=65.454545=1:05:27

#### goodstudent

A very interesting probability question:

A city is 1-sq. mile by 1-sq. mile, with city hall at the origin. The odd thing about this city is that people can only walk in straight lines and no diagonals. If houses are uniformly distributed throughout the city, what is the expected walking distance to city hall?

This is the Manhattan or Taxicab metric. The distance is:
$$Distance(p,q)\equiv\sum_{i=1}^n {|p_i-q_i|}$$
where p and q are vectors.

Since houses are uniformly distributed, my guess is half a mile.

And do you mean that the city is 1 mile by 1 mile?

#### APalley

Yes, I mistyped, the city is 1 sq. mile, or 1-mile by 1-mile.

1/2 a mile is a good guess, but incorrect. The solution is a bit more complicated than that.

This is the Manhattan or Taxicab metric. The distance is:
$$Distance(p,q)\equiv\sum_{i=1}^n {|p_i-q_i|}$$
where p and q are vectors.

Since houses are uniformly distributed, my guess is half a mile.

And do you mean that the city is 1 mile by 1 mile?

#### goodstudent

Yes, I mistyped, the city is 1 sq. mile, or 1-mile by 1-mile.

1/2 a mile is a good guess, but incorrect. The solution is a bit more complicated than that.

Hmm... if the houses are uniformly distributed, and people are walking from these houses... It would make sense if on average, the distance is one half of a mile.

Imagine a square with a star in the center. And consider the following picture:

Any house inside that diamond shape will have a distance less than equal to 1/2 mile. The rest of the area (which equals the area of the diamond) contain houses that takes 1/2 to 1 mile to get to the center. So it makes sense for it to be 1/2..

I am getting this awkward feeling that I am missing something... :-ss

#### APalley

Any house inside that diamond shape will have a distance less than equal to 1/2 mile. The rest of the area (which equals the area of the diamond) contain houses that takes 1/2 to 1 mile to get to the center. So it makes sense for it to be 1/2..
:-ss

City Hall is located at the origin, not the center of the city.

An interesting twist on this problem would be to use a non-uniform distribution, though it would require a similar method to solve.

#### Mr Doe

You haven't mentioned how much straight walks are people allowed to make; if they are allowed to make finite straight walks, we procede as follows, each house is represented by a point ((x,y)\in [0,1]\times [0,1]), no matter how much finite walks a person makes, the total distance will be (x+y) (you can easily check that), so the expected walking distance will be (\mathbb{E}[X+Y]) where (X,Y\sim U(0,1)), this boils down to calculating integral (\int_0^1\int_0^1(x+y)dxdy) (which happens to equal 1 if I'm not wrong).
If we are allowed to make infinite many steps, we can make them infinitesimally small, hence the total walking distance will be (\sqrt{x^2+y^2}) (that will mean that we are actually walking diagonally), again the expected distance will equal (\mathbb{E}[\sqrt{X^2+Y^2}]) where (X,Y\sim U(0,1)). Feel free to calculate the desired instead of me.

#### APalley

You haven't mentioned how much straight walks are people allowed to make; if they are allowed to make finite straight walks, we procede as follows, each house is represented by a point ((x,y)\in [0,1]\times [0,1]), no matter how much finite walks a person makes, the total distance will be (x+y) (you can easily check that), so the expected walking distance will be (\mathbb{E}[X+Y]) where (X,Y\sim U(0,1)), this boils down to calculating integral (\int_0^1\int_0^1(x+y)dxdy) (which happens to equal 1 if I'm not wrong).
If we are allowed to make infinite many steps, we can make them infinitesimally small, hence the total walking distance will be (\sqrt{x^2+y^2}) (that will mean that we are actually walking diagonally), again the expected distance will equal (\mathbb{E}[\sqrt{X^2+Y^2}]) where (X,Y\sim U(0,1)). Feel free to calculate the desired instead of me.

I encountered the same when I saw this problem. However, I find the whole concept of the limit to become a diagonal to be odd; you can make X and Y arbitrarily small and still have X+Y. But when they approach 0, it suddenly becomes smaller? It seems that a diagonal may be fundamentally different then the sum of arbitrarily small step-lines. How do you explain that phenomenon?

#### goodstudent

Actually, the answer here is (\frac{1}{4}). It's easy to only consider half the possibilities when you work this one.

As Andy has said, this basically amounts to asking the question: Pick two points on the interval (0,1); what's the probability that none of the three resulting intervals is longer than (\frac{1}{2})?

Consider first the circumstance where the first point--(x_1)--is on the interval ((0,\frac{1}{2})). Where can we place the second point in order to make the desired result happen?

It's fairly clear that the interval ((\frac{1}{2}, x_1 + \frac{1}{2})) is the answer to that question. This interval has length (x_1). Thus, the probability of success, given (x_1 < \frac{1}{2}), is (x_1), since our second cut is uniformly distributed on (0,1).

The probability of success overall, then, is the integral of this probability over all choices of (x_1 < \frac{1}{2}):
(\int_0^{\frac{1}{2}}x_1dx_1 = \frac{1}{2}(\frac{1}{4}-0) = \frac{1}{8})

But remember that we started the problem under the constraint (x_1 < \frac{1}{2}). Clearly, the problem is symmetric, so the probability of success with (x_1 > \frac{1}{2}) is the same again--(\frac{1}{8}).

Altogether, then, the probability of success is (\frac{1}{4}).

Another way is to use geometry.

Since the segment is cut by two points x1 and x2, length of x1 needs to the less than 1/2, OR length of x2 need to be less than 1/2, AND |x1-x2|<1/2.

So if you plot x1 and the x-axis and x2 and the y-axis, you end up with a square of 1x1 that is the set of all possible outcomes of the two random variables.

Since either length(x1)<1/2 or length(x2)<1/2, but not both, we are talking about union of the following two sets:

1. x1 exists in [0, 1/2], x2 exists in [1/2, 1]
2. x2 exists in [0, 1/2], x1 exists in [1/2, 1]

And since |x1-x2|<1/2, we are talking about the intersection of the following three sets:

1. the union of the previous two sets
2. x2 > x1 - 1/2
3. x2 < x1 + 1/2

Clearly, the total area is two triangles that add up to 1/4

I'm sorry if I didn't make any sense, but it makes sense in my head... Happy holidays!

#### drowsy

##### Cool Russian dude
Questions that I got for an entry level position:

1) Explain how a forward contract is priced
2) How does the volatility affect an option price? Can the derivative be negative? Give an example. Explain different options, which one is more/less expensive, explain geom. BM, Black-Scholes, all greek names, etc
3) How do you price a swap...
4) Explain Girsanov's theorem
4) find Laplace transform of the first passage time of BM (Shreve, thm 3.6.2)
5) Price a bond in Hull-White model
6) Some stuff about credit models, generator matrices, how do you regularize a matrix, etc...
6) Solve Ornstein-Uhlenbeck equation

something else, but I forgot already. No silly puzzles at all.

#### ImpliedVolatility

I think it should be:

0.75 + 0.25*0.20 = 0.8.

What are other people's thoughts?

P(rolling a number on any toss) = 1/6
P(telling truth) = 1/4
P(lie) = 1- (1/4) = 3/4

P(rolls 6|he says the truth) + P(doesn't roll 6|he lies) = (1/6)*(1/4) + (1/6)*(3/4)

#### Amaan

ImpliedVolatility:

P(rolling a number on any toss) = 1/6
P(telling truth) = 1/4
P(lie) = 1- (1/4) = 3/4

P(rolls 6|he says the truth) + P(doesn't roll 6|he lies) = (1/6)*(1/4) + (1/6)*(3/4)

--------------------------------------
Your answer = 1/6 which means it doesn't matter whether he lies or not. I am skeptical!

r: report ; d = die ; T = truth ; L = lie;

p(d=6|r=6) = p(d=6|r=6; T) p(T) + P(d=6|r=6; L) p(L) = 1* 1/4 + 0 * 3/4 = 1/4.

which I think makes sense cause once he reports 6, the question is reduced to "does he tell the truth"? which has a p=1/4.

#### harmonic

This case shouldn't be possible. The total number of win games is 18+40*11 = 458, and the total number of loss games is 22+40*9 = 382. Apparently, the total win number should always equal the total loss number.

Yes. Assume that each team plays 40 games. One team wins 18 and loses the rest. The other teams lose nine, win eleven and tie twenty each.

#### ImpliedVolatility

ImpliedVolatility:

P(rolling a number on any toss) = 1/6
P(telling truth) = 1/4
P(lie) = 1- (1/4) = 3/4

P(rolls 6|he says the truth) + P(doesn't roll 6|he lies) = (1/6)*(1/4) + (1/6)*(3/4)

--------------------------------------
Your answer = 1/6 which means it doesn't matter whether he lies or not. I am skeptical!

r: report ; d = die ; T = truth ; L = lie;

p(d=6|r=6) = p(d=6|r=6; T) p(T) + P(d=6|r=6; L) p(L) = 1* 1/4 + 0 * 3/4 = 1/4.

which I think makes sense cause once he reports 6, the question is reduced to "does he tell the truth"? which has a p=1/4.

Yes, you are right it does not make a difference. The way the question has been setup it is obvious, regardless of the outcome the man will call a 6. So the probability in question here is the probability of the die hitting a 6 which is 1/6. I was just showing how to arrive at the answer.

But you do not need the r:report. Report and T/L are the same for this question. And therefore you are wrong in the calculation of the probability.

#### CGiuliano

Really hard interview question

They asked me this one and I still haven't gotten it...

You are a chicken that cannot fly in the center of a circular chicken coop.

Farmer joe wants to eat you, but he is lazy and will only catch you if you are at some point on the circumference. Also, he moves at a rate 4 times faster than you along the circumference towards the point you are headed for.

If you get to the circumference before the farmer you can trigger an electric fence and he will die. If he gets to the circumference before you he will catch you and eat you.

Is there any point on the circumference that you can get to before farmer joe?

I know this has to do with angular velocity, but I can't get it...

#### Dibbs

They asked me this one and I still haven't gotten it...

I know this has to do with angular velocity, but I can't get it...

I don't think it does. It's got to do with linear velocity (the speed at which the humanoid walks on the circumference). Does the chicken only walks in a straight line from the center to the circumference ? or can it change strategies ?

#### CGiuliano

I don't think it does. It's got to do with linear velocity (the speed at which the humanoid walks on the circumference). Does the chicken only walks in a straight line from the center to the circumference ? or can it change strategies ?

Straight line only... And "angular velocity" was the hint. Any ideas?

Thanks for the response.

#### Dibbs

Straight line only... And "angular velocity" was the hint. Any ideas?

Thanks for the response.

Well, angular velocity and linear velocity are related. Angular velocity is the speed of an object in relation to his center of rotation (center of the circle). So the human is moving at x radians / seconds. Now if you want to get his linear speed, which is distance / time, you need to multiply by the radius.

Now you can maybe consider some cases. What if the chicken goes to one side of the circle, and the farmer is initally located at the diametrically opposite side of where the chicken wants to go ? How much time does it take for the chiken to get there ? And the human ?

#### CGiuliano

Again thanks for your help, but....

I believe you can change strategies at any point in time...

I think this is fair game since the question does not specify that you must head in a straight-line.

#### goodstudent

Straight line only... And "angular velocity" was the hint. Any ideas?

Thanks for the response.

If the chicken is not allowed to change direction, then it will lose for sure. Obviously, it would want to run toward the opposite end of the circle. Let Th be the time of the human, and Tc be the time of the chicken, one can show that:

Th/Tc = pi/4 < 1, so the human will get there before the chicken.

If the chicken is allowed to zigzag, then it can easily beat the human.

Replies
0
Views
4K
Replies
2
Views
89K
Replies
2
Views
5K
Replies
11
Views
9K
Replies
24
Views
18K