Domanda di colloquio di VNG Corporation

Leet code problem, Data structure and algorithm question