Microsoft interview question

Basic data structure and alg