DeCurtis interview question

Data structure and programming logics based