Meta interview question

Leet code average difficulty problem