Question d’entretien chez Yandex

2 tasks looks like leetcode easy-medium.