Meta Interview Question

Leetcode problem