Meta interview question

It was a LeetCode medium problem