All Lyft's
firstProbability (19 questions)
1. Bobo the amoeba has a 25%, 25%, and 50% chance of producing 0, 1, or 2 offspring, respectively. Each of Bobo’s descendants also have the same probabilities. What is the probability that Bobo’s lineage dies out?
2. In any 15-minute interval, there is a 20% probability that
you will see at least one shooting star. What is the proba- bility that you see at least one shooting star in the period of an hour?
3. How can you generate a random number between 1 - 7 with only a die?
4. How can you get a fair coin toss if someone hands you a coin that is weighted to come up heads more often than tails?
5. You have an 50-50 mixture of two normal distributions with the same standard deviation. How far apart do the means need to be in order for this
distribution to be bimodal?
6. Given draws from a normal distribution with known parameters, how can you simulate draws from a uniform distribution?
7. A certain couple tells you that they have two children, at least one of which is a girl. What is the probability that they have two girls?
8. You have a group of couples that decide to have children until they have their first girl, after which they stop having children. What is the expected gender ratio of the children that are born? What is the expected number of children each couple will have?
9. How many ways can you split 12 people into 3 teams of 4?
10. Your hash function assigns each object to a number between 1:10, each with equal probability. With 10 objects, what is the probability of a hash collision? What is the expected number of hash collisions? What is the expected number of hashes that are
unused.
11. You call 2 UberX’s and 3 Lyfts. If the time that each takes to reach you is IID, what is the probability that all the Lyfts arrive first? What is the probability that all the UberX’s arrive first?
- probability that the first car is Lyft = 3/5
- probability that the second car is Lyft = 2/4
- probability that the third car is Lyft = 1/3 Therefore, probability that all the Lyfts arrive first = (3/5) * (2/4) * (1/3) = 1/10
All Uber's first
- probability that the first car is Uber = 2/5
- probability that the second car is Uber = 1/4 Therefore, probability that all the Ubers arrive first = (2/5) * (1/4) = 1/10
12. I write a program should print out all the numbers from 1 to 300, but prints out Fizz instead if the number is divisible by 3, Buzz instead if the number is divisible by 5, and FizzBuzz if the number is divisible by 3 and 5. What is the total number of numbers that is either Fizzed, Buzzed, or FizzBuzzed?
- 100+60-20=140
13. On a dating site, users can select 5 out of 24 adjectives to describe themselves. A match is declared between two users if they match on at least 4 adjectives. If Alice and Bob randomly pick adjectives, what is the probability that they form a match?
- 24C5*(1+5(24-5))/24C5*24C5 = 4/1771
14. A lazy high school senior types up application and envelopes to n different colleges, but puts the applications randomly into the envelopes. What is the expected number of applications that went to the right college?
- 1
15. Let’s say you have a very tall father. On average, what would you expect the height of his son to be? Taller, equal, or shorter? What if you had a very short father?
- Shorter. Regression to the mean
16. What’s the expected number of coin flips until you get two heads in a row? What’s the expected number of coin flips until you get two tails in a row?
- After the first two flips, you can see this problem as a Markov chain, with states HH, HT, TH, TT.
- HH is the final state. You can than define the expected number of steps N before reaching HH: E(N) = 2 + 0.25nHH, 0.25nHT, 0.25nTH, 0.25nTT. nXX represents the expected number of steps before reaching HH starting from state XX.
- Solve linear equation:
- nHH = 0
- nHT = 1 + 0.5nTT + 0.5nTH
- nTH = 1 + 0.5nHH + 0.5nHT
- nTT = 1 + 0.5nTH + 0.5nTT
- Result gives E(N) = 6.
17. Let’s say we play a game where I keep flipping a coin until I get heads. If the first time I get heads is on the nth coin, then I pay you 2n-1 dollars. How much would you pay me to play this game?
- less than $3
18. You have two coins, one of which is fair and comes up heads with a probability 1/2, and the other which is biased and comes up heads with probability 3/4. You randomly pick coin and flip it twice, and get heads both times. What is the probability that you picked the fair coin?
- 4/13
19. You have a 0.1% chance of picking up a coin with both heads, and a 99.9% chance that you pick up a fair coin. You flip your coin and it comes up heads 10 times. What’s the chance that you picked up the fair coin, given the information that you observed?
- Events: F = "picked a fair coin", T = "10 heads in a row"
- (1) P(F|T) = P(T|F)P(F)/P(T) (Bayes formula)
- (2) P(T) = P(T|F)P(F) + P(T|¬F)P(¬F) (total probabilities formula)
- Injecting (2) in (1): P(F|T) = P(T|F)P(F)/(P(T|F)P(F) + P(T|¬F)P(¬F)) = 1 / (1 + P(T|¬F)P(¬F)/(P(T|F)P(F)))
- Numerically: 1/(1 + 0.001 * 2^10 /0.999).
- With 2^10 ≈ 1000 and 0.999 ≈ 1 this simplifies to 1/2
20. What is a P-Value ?
- The probability to obtain a similar or more extreme result than observed when the null hypothesis is assumed.
- ⇒ If the p-value is small, the null hypothesis is unlikely