give integer array num length n integer num range 1 n integer appear twice return array integer appear twiceyou write algorithm run on time use constant extra space Example 1input num 43278231output 23example 2input num 112output 1example 3input num 1Output Constraintsn numslength1 n 1051 numsi nEach element num appear twice