Jane Street interview question

How do you optimally play this card game?