Medtronic interview question

Coding question was been asked