Doctor Alliance interview question

Coding and Logical Question