# HELP! Optiver QR Question

#### Lucky_B

An ant leaves its anthill in order to forage for food. It moves with the speed of 10cm per second, but it doesn't know where to go, therefore every second it moves randomly 10cm directly north, south, east or west with equal probability.

1. If the food is located on east-west lines 20cm to the north and 20cm to the south, as well as on north-south lines 20cm to the east and 20cm to the west from the anthill, how long will it take the ant to reach it on average?
2. What is the average time the ant will reach food if it is located only on a diagonal line passing through (10cm, 0cm) and (0cm, 10cm) points?
3. Can you write a program that comes up with an estimate of average time to find food for any closed boundary around the anthill? What would be the answer if food is located outside an defined by ( (x – 2.5cm) / 30cm )2 + ( (y – 2.5cm) / 40cm )2 < 1 in coordinate system where the anthill is located at (x = 0cm, y = 0cm)? Provide us with a solution rounded to the nearest integer.

#### CrossGamma

So not showing any attempt whatsoever you just expect people to solve it for you?

#### Daniel Duffy

##### C++ author, trainer
An ant leaves its anthill in order to forage for food. It moves with the speed of 10cm per second, but it doesn't know where to go, therefore every second it moves randomly 10cm directly north, south, east or west with equal probability.

1. If the food is located on east-west lines 20cm to the north and 20cm to the south, as well as on north-south lines 20cm to the east and 20cm to the west from the anthill, how long will it take the ant to reach it on average?
2. What is the average time the ant will reach food if it is located only on a diagonal line passing through (10cm, 0cm) and (0cm, 10cm) points?
3. Can you write a program that comes up with an estimate of average time to find food for any closed boundary around the anthill? What would be the answer if food is located outside an defined by ( (x – 2.5cm) / 30cm )2 + ( (y – 2.5cm) / 40cm )2 < 1 in coordinate system where the anthill is located at (x = 0cm, y = 0cm)? Provide us with a solution rounded to the nearest integer.
This is a great exercise; put on your thinking cap!

1. First, you have to understand the problem.
2. After understanding, make a plan.
3. Carry out the plan.
4. Look back on your work. How could it be better?

#### Sudhansh Dua

An ant leaves its anthill in order to forage for food. It moves with the speed of 10cm per second, but it doesn't know where to go, therefore every second it moves randomly 10cm directly north, south, east or west with equal probability.

1. If the food is located on east-west lines 20cm to the north and 20cm to the south, as well as on north-south lines 20cm to the east and 20cm to the west from the anthill, how long will it take the ant to reach it on average?
2. What is the average time the ant will reach food if it is located only on a diagonal line passing through (10cm, 0cm) and (0cm, 10cm) points?
3. Can you write a program that comes up with an estimate of average time to find food for any closed boundary around the anthill? What would be the answer if food is located outside an defined by ( (x – 2.5cm) / 30cm )2 + ( (y – 2.5cm) / 40cm )2 < 1 in coordinate system where the anthill is located at (x = 0cm, y = 0cm)? Provide us with a solution rounded to the nearest integer.
very interesting, thanks for sharing

#### KiwiEngineer

I got 4.5 seconds for the first one using Markov Chains.
For b, I am not sure how to prove it, but it seems like the answer is infinite?
Did anyone else try to solve this one

#### bigbullboy

I got 4.5 seconds for the first one using Markov Chains.
For b, I am not sure how to prove it, but it seems like the answer is infinite?
Did anyone else try to solve this one
Hey, I have been reading about simple random walks in 1d and 2d and trying to apply markov chains to find the stopping time but I am just not able to do so. I know that the answer for part b is infinite because there isn't a closed boundary. Would you be willing to help me understand how you got the answer to part a or point me to some resources which I can use to learn the necessary material?

#### DivyaTush

I got 4.5 seconds for the first one using Markov Chains.
For b, I am not sure how to prove it, but it seems like the answer is infinite?
Did anyone else try to solve this one
hello, even i have got the answer 4.6 from markov chain.
I used programming, would you mind to direct me to some resources?