You are given an array nums representing [1,2,...,n] where one number is missing and one appears twice. Return [duplicate, missing].
nums = array with one duplicate and one missing
[duplicate, missing]
Example 1:
Input:
nums = [1,2,2,4]
Output:
[2,3]
Explanation:
2 appears twice and 3 is missing.