Digitville keeps a list nums that should hold every integer from 0 to n - 1 exactly once. Two mischievous numbers each sneaked in one extra time, so the list now has n + 2 elements. Return the two sneaky numbers as an array of size two, in any order.
Digitville keeps a list nums that should hold every integer from 0 to n - 1 exactly once. Two mischievous numbers each sneaked in one extra time, so the list now has n + 2 elements. Return the two sneaky numbers as an array of size two, in any order.
Example 1:
Input: {"nums":[0,1,1,0]}
Output: [0,1]
Constraints:
2≤n≤100
nums.length=n+2
0≤nums[i]<n
The input has exactly two repeated elements.
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"nums":[0,1,1,0]}
4 numbers, but only the values 0..1 exist, so exactly two values must show up twice.