Meta Interview Question

It was a LeetCode medium problem