Question d’entretien chez X

Build some UI with React. Solve this algorithm question.