Meta Interview Question

It was leetcode based question. A slight modification