Meta interview question

2 medium questions, consisting of leetcode problems.