Meta interview question

LeetCode style questions. 2 mediums