You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers got duplicated and another number got missing.
You are given an integer array nums representing the data status of this set after the error. Find the number that occurs twice and the number that is missing, and return them as an array [duplicate, missing].
Example 1:
Input: nums = [1, 2, 2, 4]
Output: [2, 3]
Explanation: 2 appears twice, 3 is missing.
Example 2:
Input: nums = [1, 1]
Output: [1, 2]
Explanation: 1 appears twice, 2 is missing.
Example 3:
Input: nums = [3, 2, 3, 4, 6, 5]
Output: [3, 1]
Explanation: 3 appears twice, 1 is missing.
2 <= nums.length <= 10^41 <= nums[i] <= n