Meta interview question

Two leetcode questions. One easy, one hard