This is the last week of my series on how to prepare for a trading interview. This week, I’m going to review programming and statistics ideas and look at more difficult problems in areas where I’ve already done practice problems. Aside from these topics, I’ll mostly be pulling past interview questions from Glassdoor pages and Leetcode. As always, I’ll give you answers to the problems I work on, a list of the materials I use to go over ideas again, and a list of extra problems I’ll work on after this week is over.
Expected value is a key concept in probability and statistics that comes up frequently in job interviews, especially for roles in data science, analytics, finance, and other quantitative fields. As a job seeker, you need to thoroughly understand expected value and how to calculate it in order to confidently answer interview questions on this topic.
In this comprehensive guide, I’ll explain what expected value is, why it’s important, and provide example expected value interview questions with detailed answers. I’ll also share tips on how to prepare for and ace expected value questions in your next job interview. By the end, you’ll have a solid grasp of this concept and know exactly how to approach related questions.
What is Expected Value?
Expected value (EV) is the average value of a random variable over many trials It gives you the long term average result if you repeat an experiment or process many times,
For example, if you roll a 6sided die, the expected value is 35 This is because if you roll the die many times and take the average, it will tend towards 3.5. Each number (1 to 6) is equally likely to appear, so the average expected roll is (1 + 2 + 3 + 4 + 5 + 6) / 6 = 3.5.
More formally:
The expected value of a discrete random variable X is calculated as the probabilityweighted average of all possible values.
EV(X) = ∑x*P(x)
Where x is each possible outcome and P(x) is the probability of that outcome occurring.
For continuous distributions, we calculate the EV by integrating over the distribution rather than summing.
EV(X) = ∫xf(x) dx
Where f(x) is the probability density function.
Why is Expected Value Important?
Expected value is important because it allows us to estimate the longterm results of a probabilistic process. Even though individual outcomes may vary randomly, the expected value gives us the central tendency.
Some key applications of expected value include:

Decision Making: Expected value helps make optimal decisions under uncertainty by estimating payoffs of different options.

Predictions: We can forecast future outcomes based on expected values from probability models.

Risk Assessment: Expected value quantifies the average impact of potential risks to help manage them.

Resource Allocation: Investing resources in options with higher expected payoffs leads to better longterm results.

Pricing: Insurance companies and gambling operators use expected value to set prices that ensure profitability.
Overall, expected value is a versatile tool for modeling realworld uncertainties across many fields. Mastering this concept is key for anyone working with data, risk, or strategy.
Expected Value Interview Questions and Answers
Now let’s look at some common expected value interview questions and example responses:
Q1: How would you calculate the expected value of a probability distribution?
To calculate the expected value of a probability distribution, we take the sum of each outcome multiplied by its probability.
For discrete distributions, it is calculated as:
EV = ∑x*P(x)
Where x is each possible outcome and P(x) is the probability of that outcome occurring.
For continuous distributions, the expected value is calculated as:
EV = ∫xf(x) dx
Where f(x) is the probability density function.
For example, if a coin flip has a 50% probability of heads and 50% probability of tails, the EV is:
EV = (0.5 * $1) + (0.5 * $0) = $0.50
The calculation sums the probability of each outcome times its payoff.
Q2: How is expected value used in reinforcement learning algorithms?
In reinforcement learning, the goal is for an agent to learn the optimal policy that maximizes reward. Expected value is key for the agent to make optimal decisions.
The agent maintains a value function that estimates the expected future reward for taking each action in a particular state. It then selects the action with the highest expected value to maximize longterm rewards.
By updating action values based on the expected rewards received, the agent improves its policy over time through trial and error. This allows it to find the optimal action choices leading to the greatest reward. Expected value enables the agent to make informed decisions by predicting future payoffs.
Q3: What is the relationship between expected value and variance?
Expected value gives the central tendency of a distribution – it tells us the average outcome over many trials. Variance tells us how dispersed the outcomes are around this average.
A low variance indicates the outcomes are clustered close to the expected value. A high variance means there is significant unpredictability in outcomes, with extreme values being more likely.
While expected value provides a sense of the “typical” result, variance quantifies the variability around this typical case.
The two metrics offer complementary insights. Expected value informs our central forecast while variance indicates the uncertainty in this forecast.
Q4: How can you determine if an investment is worth pursuing based on expected value?
To determine if an investment is worth pursuing based on expected value, we compare its expected payoff to the required investment.
First, we calculate the expected value by estimating the probability of each potential gain or loss scenario. We multiply each outcome by its probability and sum them.
If the expected value exceeds the required investment amount, the investment is worth pursuing since we expect a positive net payoff.
However, expected payoff alone isn’t sufficient. We should also consider the variance, our risk tolerance, opportunity cost, and other factors before making investment decisions. But expected value provides a baseline for estimating profitability.
Q5: What are some cases where expected value would be misleading for decision making?
Some cases where expected value alone can be misleading include:

Low probability extreme events: A low EV could hide potentially catastrophic low probability risks. E.g. earthquake insurance.

Risk preferences: EV assumes all outcomes are valued linearly. In reality, people may be risk averse or risk seeking.

Nonmonetary factors: Intangibles like quality of life, satisfaction, etc. are ignored in monetary EV calculations.

Input uncertainty: Garbage in, garbage out. If the probabilities used are inaccurate, EV will be misleading.
To account for these, we should use expected value in conjunction with other tools like sensitivity analysis, utility theory, simulation, and human judgement. Relying solely on EV can lead to poor decisions in many practical scenarios with complex risks.
Q6: How would you calculate the expected profit from selling a product given the probability distribution of demand?
First, I would define a demand probability distribution that captures the likelihoods of different volume scenarios – high, medium, and low demand. For each demand amount, I can calculate the corresponding profit by multiplying revenue (price x quantity) and subtracting costs.
Next, I would calculate the expected value of profit. This is done by multiplying the profit achieved under each demand scenario by the probability of that demand occurring.
For example:
 P(High) = 20% Profit = $5000
 P(Medium) = 60% Profit = $3000
 P(Low) = 20% Profit = $1000
The expected profit is then calculated as:
 EV = (20% x $5000) + (60% x $3000) + (20% x $1000) = $3200
This gives the average profit over many trials that accounts for demand variability. The business can use this EV to guide production, pricing, and investment decisions.
Q7: How would you compute the expected payoff of playing a game with multiple stages?
For a multistage game, I would break down the expected value calculation stagebystage using backward induction. This involves working backward from the final stage to the initial stage.
At each stage, I would determine the possible outcomes, their payoffs, and probabilities. Then calculate the EV for that stage accounting for future payoffs.
Once the EV of the final stage is computed, it becomes the payoff for the second last stage. This recursively provides the EV going backward until the initial stage.
The initial stage EV calculated in this manner represents the overall expected payoff from playing the multistage game optimally. It incorporates the probabilities and rewards at each stage.
Tips for Acing Expected Value Interview Questions
Here are some tips to help you thoroughly prepare for expected value questions and demonstrate your ability to use this concept:

Review probability concepts like random variables, distributions, density functions, etc. Ensure you understand these building blocks.

Practice defining expected value formally and explaining what insights it provides. Use examples to illustrate.

Be able to manually calculate expected values for both discrete and continuous distributions.

Think about realworld examples and business cases where expected value would be useful for decision making under uncertainty.

Consider edge cases where expected value alone could lead to incorrect decisions, and how to mitigate this.

Ask clarifying questions if the interviewer’s question is ambiguous or lacks key information.

Where relevant, supplement your expected value analysis by also discussing risk, simulations, utility theory, etc.
With practice and a solid grasp of
Day Fifteen: July 8
Here are some more betting games from previous interviews.
Problem 1. There are 13 cards in a deck, and all of them are clubs. You can pick two from them and get paid their product; all face cards are worth 0. It costs 111 to find the difference between any two cards you pick. How much would you pay to play this game? Our chance of getting a nontrivial result (not picking a J,Q,KJ,Q,KJ,Q,K) if we just guess is (102)(132)=1526frac{binom{10}{2}}{binom{13}{2}} = frac{15}{26}(213)(210) =2615 We’ll aim to improve this and maximize our payout from this game. We’ll number our cards from left to right and call them C1, C2,…, C13C_1, C_2, dots, C_13C1…, C2…, C1…3, with CiC_iCi referring to the ith card from the left. WOLOG lets make C1C_1C1 the card that we compare all other ones to. There are 222 more face cards after C1C_1C1 in the next 121212 cards, so it will take 111111 comparisons to find a second face card. When we do, we’ll see that the difference between C1C_1C1 and the new face card is 000. From there, we know that every comparison we’ve made so far has given us the exact value of each card. This lets us choose the 999 and 101010 cards for a $90 to $90 payout. Mind you, this is the worstcase scenario. We could find the second zero much sooner, and it’s our only goal to find the 9,109,109,10 cards by comparing them directly.
If the first card isn’t a face card, we’ll look at the next 121,212 cards and compare them to C1C_1C1. After going through 111111 cards, we’ll find at least 222 face cards. This is when we’ll realize that two of the comparisons we’ve made show the same difference between the cards. There are two face cards that have the same difference from C1C_1C1. This means that their difference from C1C_1C1 is just the value of C1C_1C1. Once you have that, you can figure out the values of the other cards you looked at to find the 9,109,109,10 cards. We could also see situations where this happens before the 11th comparison. In that case, we would only need to find the 9,109,109,10 cards again by comparing them. From these two cases, we’ve confirmed that spending $11$11$11 can guarantee a payout of $90$90$90. Then I’d pay up to $79 to play this game, which makes sure I’ll always have a pleasant expectation. Keep in mind that 797979 is not the expected value of the game because we’d have to think about all the different ways the cards could go. That would be a lot of work, though, so I’m willing to pay up to or a little more than $79
$79$79. I’m willing to pay more than $79 because that amount guarantees a nonnegative payout. Also, this will likely make us money because we’ve only looked at the worstcase scenario so far and not the average game.
Problem 2. We randomly sample integers a,b,ca,b,ca,b,c from a uniform distribution of [0,1][0,1][0,1]. What is the probability that ax2+2bx+c=0ax^2 + 2bx + c = 0ax2+2bx+c=0 has real roots? Solution. The given quadratic equation must have real roots if 4b2−4ac≥04b^2 – 4ac
for XXX exponential and YYY with the pdf xe−xxe^{x}xe−x for x>0x>0x>0. Since XXX and YYY are independent, we have.
Then the probability that our quadratic equation has real roots is 59frac{5}{9}95. This solution relies on drawing the connection between the negative log of a uniform distribution on [0,1][0,1][0,1] being exponential and the sum of exponential distributions with λlambdaλ parameter having a pdf of λ2xe−λxlambda^2 xe^{lambda x}λ2xe−λx. A more basic case of this problem with ax2+bx+c=0ax^2 + bx + c = 0ax2+bx+c=0 can be found here.
Problem 3. Let’s play a game. I’ll give you a die with 12 sides and pay you whatever it lands on. I will pay you the sum of the two dice if you choose to roll again if you are unhappy with the roll. How much are you willing to pay to play this game? Solution. This is a Jane Street interview question that I came across on their Glassdoor page. There is a chance that the second die will have a value less than 777, since the expected value of two fair dice added together is 777. This means that we should roll again if the result is less than 777. This occurs with probability 12frac{1}{2}21 so we have 12frac{1}{2}21 chance of getting a $7$7$7 payoff. We also have a 12^frac{1}{2}21 chance of rolling at least a 777, which means we can expect to win 16(7 8 9 10 11 12)=9. 5frac{1}{6}(7 + 8 + 9 + 10 + 11 + 12) = 9. 561(7+8+9+10+11+12)=9. 5 for the scenario that we roll at least a 777 of the 121212sided die. Then, the total expected value is 12⋅7+12⋅9. 5=8. 25frac{1}{2} cdot 7 + frac{1}{2} cdot 9. 5 = 8. 2521⋅7+21⋅9. 5=8. 25. Then it follows that I’d pay up to $8. 25$8. 25$8. 25 to play this game, assuming that I’m using the optimal strategy that I described above.
Problem 4. Given n nonnegative integers a1,a2,…,ana_1, a_2, dots, a_na1,a2,…,an , where each represents a point at coordinate (i,ai)(i, a_i)(i,ai). n vertical lines are drawn such that the two endpoints of line iii is at (i,ai)(i, a_i)(i,ai) and (i,0)(i, 0)(i,0). Find two lines, which together with xaxis forms a container, such that the container contains the most water. Solution. This is another Leetcode medium question. The brute force solution involves comparing every possible pair of lines and the volumes of containers that they build, which run in O(n)O(n)O(n) time. On the other hand, we can approach the question with the following intution: given two lines, the area of the container formed is limited by the height of the lower stick. In hopes of getting a taller line, we would shift the lower line one unit to the right (or left depending which is shorter), which will decrease the width but add the potential of increasing the height of the next line. After each iteration of line moving, we’ll check the area again and make updates to the maximum area should that be applicable. This is done as opposed to moving the taller line, which would decrease the width of the container and add no possibility of improved height. This method won’t always guarantee us a larger area, but it encompasses all the possibilites of higher sticks adding area as we “traverse” the array. This gives us the following solution:
This solution runs in O(n)O(n)O(n) time, but does waste some resources. Moving from one line to the next is done so that we can make up for the narrower width by getting to a higher line. We can be sure that the next area we look at has a stick that is higher by using a while loop to keep adding to our line index until we find a line that is taller than the one we thought was too short. For this to work, all you would have to do is change left to while(height[left]
Day Thirteen: July 6
Most of today’s problems are past interview questions in trading!
Problem 1. You have a drawer with an infinite number of two colors of socks, which exist in equal probability. How many times do you think someone will have to take socks out of the drawer one at a time before they find a pair that goes together? This is a past Jane Street interview question that should be answered without pen/paper. Note that a matching pair of socks must be found by the third draw by the pidgeonhole principle. Twelve times out of twentyone, we’ll draw the same color on the second round, and twelve times out of twentyone, we’ll draw a different color. If we draw a third color, we will definitely finish a pair of matching socks in the third round. This means that the odds of finishing the pair in two or three rounds are equal. Then then expected number of attempts is 2. 52. 52. 5.
Problem 2. There is a raffle with 80 total tickets. Three tickets win a prize. I buy 5 tickets. What is the approximate probability that I win exactly one prize? Solution. We can solve this problem using either combinatorial or brute force methods. I like combinatorial methods better, but brute force methods make more sense. There are (31)binom{3}{1}(13) ways to choose one (and only one) of the three prizes. Of the remaining 777777 tickets, there are (774)binom{77}{4}(477) ways to choose four nonwinning tickets. We can add these two numbers together to find the number of possible outcomes where we only win one prize. Finally, there are (805)^binom{80}{5}(580) ways to pick 555 tickets, with some winning and some not. We divide our numerator by this number to get the chance of winning, which is about 16 89%16. 89%16. 89%. To brute force it, let’s consider each of the three prizes. Note that the probability of winning the first prize is 580frac{5}{80}805. Then, considering that we can only win one of the three prizes,.
Combining these probabilities gives us the same answer as above with our combinatorial solution.
Problem 3. Consider a deck with 262626 black and 262626 red cards. You draw one card at a time, and you can either guess ahead of time if the card will be red or just watch it happen. If the card is red you get $1$1$1 and the game ends whenever you decide to guess. What is your strategy to play this game and the expected earnings? Solution. I have no idea what the right answer is so solving this question was rather fun. The easiest way to play is to guess the first card, which has a 12frac{1}{2}21 chance of being right and an EV of $0. 50$0. 50$0. 50. However, we can aim to slighly improve this by basing our future guesses on previously drawn cards. Based on how many red and black cards are left in the deck, we can figure out what the expected value of guessing is at any given round. In the case where there are rr red and bbb blue cards left, let f(r,b)f(r,b)f(r,b) be the expected income. If there are red and black cards in a certain order, the chance of guessing correctly is f(r,b)=rr bf(r,b) = frac{r}{r b}f(r,b)=r br. This function also shows the expected value of guessing at each round. I would first draw 555 cards, hoping to get more black cards than red cards, which would raise the EV of the rest of the deck. This is where my strategy gets a little riskier. If I fall behind on this first round of draws, I’m more likely to draw more black cards than red cards in the next round, so I’ll keep doing that until I get a bit ahead of the game and have a 50% chance of drawing another red card. There is no exact science behind this, and I don’t have an answer that covers all the possible outcomes other than drawing more cards until there aren’t many cards left or a high enough chance of drawing a red card to give me the best chance of winning. This strategy adds more uncertainty to our expected payoff: instead of having a 50/50 chance of getting a dollar, we add some randomness to our draw. We can potentially go above or below 50%50%50% of guessing a red card correctly. If I do this, I run the risk of never getting back up to 50% again if I draw 6262626 red cards right away, which is a very unlikely and unfortunate outcome. Update: I’ll be posting a revised answer to this question soon!.
My estimate of the expected payoff is also a bit rough, and it’s based on a symmetry argument: let’s say we draw a series of cards, and there’s a ppp chance that the next card will be red (EV ppp). But it’s just as likely that we drew the cards in a way that made every ith card in the second sequence the opposite of the one we actually drew. This gives us an EV of 1−p1p1−p. This means that no matter what card state we choose to guess at, we have an equal chance of getting a payoff of ppp or 1−p1p1−p. This means that the overall game has no expected value. 50$0. 50$0. 50 regardless of our strategy. For the most part, I’m not sure what I gain by accepting more variability, but I think I’ll be less afraid of taking risks since I can’t lose money.
Problem 4. I want to know how to best design the elevators for a new 40story office building with an average of 100 people per floor so that the building is filled and emptied most efficiently during a typical 9–5 workday and during rush hour in my city. The answer should be as detailed as possible, including the number of people expected per car, the time per stop, the average number of floors stopped per trip at different times, etc. Solution. This is a Google PM question but the nature of this question feels very tradingesque. Each day, 40004004000 people must enter and leave the building. This is likely to happen in the morning and afternoon, close to 999 and 555. Different people will come in at different times during the workday. To make things easier, I’ll assume that the average time people arrive at the office is 9:00:00, with a standard deviation of 30 minutes. Then, we have approximately the following number of people using the elevator in various times during the morning:
7:30 – 8:00 – 808080 8:00 – 8:30 – 560560560 8:30 – 9:00 – 136013601360 9:00 – 9:30 – 136013601360 9:30 – 10:00 – 808080 10:00 – 10:30 – 808080
There will probably be some people who leave the office for lunch, but it’s not likely that the elevators will be full because many people (maybe even most of them) will stay in for lunch. Let’s say there are 1010 elevators and each one can carry an average of 1010 people, regardless of their weight. This means that 136013601360 people are coming into the building every 30 minutes. Then each elevator should make 1360100=13. 6frac{1360}{100} = 13. 61001360=13. 6 trips between the first floor and carrying people up to higher floors. We should think about dividing the floors that each elevator serves into groups so that people don’t have to wait too long. This office building is pretty big, after all. It’s possible to divide this up so that each elevator serves 888 floors: Then, on average, each elevator goes up and down 999 floors per trip. Elevators 1,21,21,2 are the only ones that go up and down 888 floors per trip. This helps cut down on waste, but the elevators that go the farthest should still go between the first floor and the last 888 floors, making an average of one trip every two floors. 22. 22. 2 minutes. People can get out of an elevator pretty quickly, so we’ll give each stop an average of 555 seconds before moving on to the next floor. Then elevators 9,109,109,10 will take 40,240 seconds to go from the top floors to the bottom floors. That gives them about 90,990 seconds more to go from floor 1 to floor 40 and load up another elevator. Note that this answer could be a little more detailed, focusing on how to get the most people to use elevators on higher floors by taking into account the fact that people on lower floors will take the stairs and other random factors I haven’t thought of yet.
Problem 5. Consider a card game with two black cards and two red cards. You play a game where you draw a card each round. If it’s black you lose a dollar and if its red you win a dollar. You can choose to stop at any time. What’s your winning strategy and its associated expected value? Solution. Note that by playing the game out completely we ensure breaking even. For example, if we end the third draw with one dollar (RBRRBRRBR) or the second draw with two dollars (RRRRRR), it makes sense to stop the game because we will lose some of our winnings if we keep going. Also, if we’re behind at any point in the game, we should keep drawing because we know the end result will be even. If we’re even at any point in the game, we should keep drawing because we will either make gains or play the whole game and end even. Let’s consider what happens when we draw RRR first. Next, we’ll be up one dollar and have a 13frac{1}{3}31 chance of drawing another red (net 2 2 2), 23⋅13=13frac{2}{3}cdot frac{1}{3} = frac{1}{3}32⋅31=31of drawing two blacks, which would end the game (0 0 0), and 13frac{1}{3}31 of drawing BRBRBR afterward, which would end it (11 1 So conditional of drawing a red first turn, we have ev 13⋅2+13⋅1frac{1}{3} cdot 2 + frac{1}{3} cdot 131⋅2+31⋅1. Now, let’s look at rolling BBB first. If you then get two reds in a row (13^frac{1}{3}31), you can win $1 and break even. If not, you’ll lose 23frac{2}{3}32. Following this plan, our total EV is 12⋅1 12(13⋅1 23⋅0)=23frac{1}{2} cdot 1 frac{1}{2}(frac{1}{3} cdot 1 frac{2}{3} cdot 0) = frac{2}{3}21⋅1 21(31 ⋅1 32⋅0)=32 This can be extended to any number of cards.
Quant Interview Questions #5  Expected Value
FAQ
How to solve expected value questions?
What is the expected value of a quant trading?
What makes you choose IFS as your next employer?
How do you answer value based interview questions?
Answering valuebased interview questions requires an understanding of a company’s culture and the individual values each question features. You might also share examples of experiences where you embodied certain values to show the interviewer that you have the skills to succeed at the company.
How many probability interview questions are there?
In this article, we list 41 probability interview questions and provide examples of the types of probability questions an interviewer might ask you to assess your statistical knowledge. A hiring manager may ask general probability interview questions during an interview to learn more about you and your background.
How do you calculate the expected value of a sample?
Second interpretation: Take one sample, compute the expected value of that one sample, then multiply that expected value by itself. For the first case, we first sample a number between 1 and N from a uniform distribution, then we multiply the expected value of that number by itself, hence we have E (X)².
Are value based questions effective?
Valuebased questions can be effective because they help interviewers determine whether a candidate might be a good fit for their company’s culture. If you’re applying to jobs, learning how to answer valuebased questions can help you succeed in an interview process.