CureMD interview question

the asked to solve a coding