Domanda di colloquio di Nutanix

Hard DSA problem which was tree+graph based question.