Meta interview question

Leetcode 1284 was the question