diff --git a/Sets/Set Mismatch b/Sets/Set Mismatch new file mode 100644 index 0000000..38f84d0 --- /dev/null +++ b/Sets/Set Mismatch @@ -0,0 +1,12 @@ +The idea is using array indexing, that is putting each nums[i] into the position with index nums[i] - 1. Then, the array becomes [1,2,3,4,5...,n]. So we can find the duplicate number when nums[i] != i+1. + +``` +vector findErrorNums(vector& nums) { + for(int i = 0; i