ZS Associates interview question

I was asked to solve the case study