Jane Street Interview Question

How do you optimally play this card game?