Meta interview question

some simple coding question from leetcode