Pregunta de entrevista de Airlines Reporting Corporation

How would you solve deadlock?