Easy
Quiz
#645 Set Mismatch
APPROACH
An integer array nums was supposed to contain each value from 1 to n exactly once, but one number was accidentally duplicated, causing another to go missing. Given nums, identify and return [duplicate, missing].
Example 1:
Input: nums = [1,2,2,4]
Output: [2,3]
Example 2:
Input: nums = [1,1]
Output: [1,2]
1 of 4
1:00
What is the optimal approach for this problem?