Question d’entretien chez Meta

Write code to solve the following problem