Micro1 interview question

Data structure and algorithm question