Polyconseil interview question

Leet code easy / medium problem