Pergunta de entrevista da empresa DRW

Difficult programming assignment.