Meta Interview Question

some simple coding question from leetcode