Genpact interview question

Data Structures related coding question in Python