Pregunta de entrevista de OpenBet

Explain how you would tackle this algorithm