Nagarro interview question

The code needs to be explained which was given in the coding round.