Meta Interview Question

Asked leetcode hard Question.