Set Mismatch

You have a set of integers nums that contains integers from 1 to n. However, there is one duplicate number…