Meta interview question

Leetcode medium should be enough to pass