Meta interview question

Leetcode problem