Meta interview question

Two leetcode problems (Medium difficulty)