Nagarro interview question

resoning question