Just add them all up, and subtract the total you would expect if only 1001 numbers were used from that.
Eg:
Input: 1,2,3,2,4 => 12
Expected: 1,2,3,4 => 10
Input - Expected => 2
More Related Contents:
- maximize the top element of the stack after performing exactly K operations
- Algorithm for all subsets of Array
- How to sort in-place using the merge sort algorithm?
- Easy interview question got harder: given numbers 1..100, find the missing number(s) given exactly k are missing
- Algorithm: efficient way to remove duplicate integers from an array
- Finding three elements in an array whose sum is closest to a given number
- Given an array of numbers, return array of products of all other numbers (no division)
- How to find the kth smallest element in the union of two sorted arrays?
- Algorithm to find k smallest numbers in array of n items
- How do you efficiently generate a list of K non-repeating integers between 0 and an upper bound N [duplicate]
- Can min/max of moving window achieve in O(N)?
- Print two-dimensional array in spiral order
- Find the majority element in array
- How to divide a set into two subsets such that difference between the sum of numbers in two sets is minimal?
- Binary Search algorithm implementations
- Algorithm to determine if array contains n…n+m?
- Find the 2nd largest element in an array with minimum number of comparisons
- Find all subsets of length k in an array
- Maximum single-sell profit
- In-place array reordering?
- find pair of numbers in array that add to given sum
- Regarding in-place merge in an array
- how to combine duplicate rows and sum the values 3 column in excel
- Interview question: three arrays and O(N*N)
- How to find repeating sequence of characters in a given array?
- Maximum sum of non consecutive elements
- Finding kth smallest number from n sorted arrays
- calculating the number of “inversions” in a permutation
- Algorithm to apply permutation in constant memory space
- Find the first element in a sorted array that is greater than the target