DotPe interview question

basic Data structure and algo