Meta Interview Question

Leetcode code question, I can't tell the number, but not very difficult.