Domanda di colloquio di Yandex

Some leetcode task, which wasn't hard