I saw the following question posted on glassdoor (https://www.glassdoor.com/Interview/You-have-3-cards-each-labeled-n-n-1-n-2-and-you-don-t-know-n-The-rules-of-the-game-All-cards-start-face-down-You-flip-QTN_1848772.htm):
You have 3 cards, each labeled n, n+1, n+2 and you don't know n. The rules of the game: All cards start face down. You flip one card. If you "stay", you get that card's value. If you don't "stay", then you flip another card. Again, choose to "stay" (and keep the 2nd card's value) or flip the final card and keep the final card's value. Design the optimal strategy.
I think there are some ambiguities, but I will assume that I know that there are 3 cards labeled $n, n+1, n+2$. We don't know $n$, so if we draw the card with value, e.g., $n+1$, we don't know if this is $n, n+1$ or $n+2$. I will also assume that the optimal strategy is to get the card with the highest value.
Here is my attempt at the problem.
The cards could have 1 of the following 6 arrangements, with equal probability.
\begin{align} n, n+1, n+2 \\ n, n+2, n+1 \\ n+1, n, n+2 \\ n+1, n+2, n \\ n+2, n, n+2 \\ n+2, n+1, n \\ \end{align}
There are 6 possible arrangements, each occurring with equal probability. Let's assume the first value we see in the above list is the first card we flip, and the last value is the last card we'll flip (if we were to flip a 3rd time).
Now I think the idea is to work backwards. We will consider 4 cases where we have drawn 2 cards.
(1)
Let's consider drawing the first card to be $x$ (note that $x$ is a random variable here) and the second to be $x+1$. The third card could thus be $x+2$ or $x-1$. $x$ and $x+1$ could correspond to $n, n+1$ or $n+1, n+2$ above with equal probability. Our expected value of staying on the second card is thus $0.5(n+1 + n+2) = n + 1.5$. Our expected value of drawing a 3rd card is $0.5(n+2 + n) = n + 1$, so we should stay on the second card and not draw a 3rd card. So expected value for this case is $n+1.5$.
(2) Let's consider drawing the first card to be $x$ and the second card to be $x - 1$. The third card could thus be $x + 1$ or $x - 2$. $x, x-1$ could correspond to $n+1, n$ or $n+2, n+1$. So the expected value of staying is $0.5(n + n + 1) = n + 0.5$. The expected value of flipping the 3rd card is $0.5(n+2 + n) = n + 1$. So we should flip the 3rd card. So expected value for this case is $n+1$.
(3) Consider first drawing $x$ then $x+2$. Then we know for sure the 3rd card is $x+1$, i.e., $n+1$, so do not flip the 3rd card and stay with our second card which is $n+2$. Expected value is $n+2$.
(4) Consider first drawing $x+2$ then $x$. Then we know for sure the 3rd card is $n+1$, so we flip the 3rd card. Expected value is $n+1$.
So using cases (1)-(4), which occur with equal probability. Edit: WRONG! They don't occur with equal probability. Cases (1) - (2) occur with twice the probability of (3) and (4)
the expected value of flipping 2 cards is thus
$$ 2/6(n + 1.5 + n + 1) + 1/6(n + 2 + n + 1) = 0.25(4n + 5.5) = n + \frac{4}{3} $$
The expected value of the first card is $n+1$ which is $< n + \frac{4}{3}$. So we should draw a second card.
Does this strategy seem logical to you guys? In the glassdoor post, there are several other solutions that do not seem to match mine.