Domanda di colloquio di Klarna

How would you solve this concurrency problem.