
Given an integer array nums of length n where all the integers of nums are in the range [1, n] and each integer appears at most twice , return an array of all the integers that appears twice .
You must write an algorithm that runs in O(n) time and uses only constant auxiliary space, excluding the space needed to store the output
n == nums.length1 <= n <= 10 ^51 <= nums[i] <= nEach element in nums appears once or twice .