EY interview question

Related to Data structure and oops