Meta Interview Question

Code interview from leet code