Finding a duplicated item in an array of N integers in the range 1 to N − 1