This challenge is an extension of the kata of Codewars: **Missing and Duplicate Number"**, authored by the user **Uraza**. (You may search for it and complete it if you have not done it)


In this kata, we have an unsorted sequence of consecutive numbers from  ```a``` to ```b```, such that ```a < b``` always (remember ```a```, is the minimum, and ```b``` the maximum value).

They were introduced an unknown amount of duplicates in this sequence and we know that there is an only missing value such that all the duplicate values and the missing value are between ```a``` and ```b```, but never coincide with them.

Find the missing number with the duplicate numbers (duplicates should be output in a sorted array).

Let's see an example:

```arr = [10,9,8,9,6,1,2,4,3,2,5,5,3]```

```find_dups_miss([10,9,8,9,6,1,2,4,3,2,5,5,3]) == [7,[2,3,5,9]]```

The code should be fast to process long arrays (maximum length aprox. = 1.000.000).
The values for the randon tests:
```
500 <= a <= 50000
a + k <= b and 100 <= k <= 1000000
amount of duplicates variable, according to the length of the array
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Sorting

Data structures

Mathematics

Starter code: def find_dups_miss(arr):
	

Solutions:
from collections import Counter

def find_dups_miss(arr):
	(mi, ma, c) = (min(arr), max(arr), Counter(arr))
	duplicates = sorted((n for n in c if c[n] > 1))
	return [ma * (ma + 1) // 2 - mi * (mi - 1) // 2 - sum(c), duplicates]


from collections import Counter

def find_dups_miss(arr):
	counter = Counter(arr)
	return [(max(counter) - min(counter) + 1) * (min(counter) + max(counter)) // 2 - sum(counter), [y for y in sorted(counter) if counter[y] > 1]]


def find_dups_miss(arr):
	dups = []
	memo = set()
	a = 100000
	b = 0
	summ = 0
	for i in arr:
		if i in memo:
			dups.append(i)
		else:
			if i < a:
				a = i
			if i > b:
				b = i
			memo.add(i)
			summ += i
	miss = int(b * (b + 1) / 2 - a * (a - 1) / 2 - summ)
	dups.sort()
	return [miss, dups]


from collections import Counter

def find_dups_miss(arr):
	C = Counter(arr)
	S = set(range(min(C), max(C) + 1))
	x = (S - set(C)).pop()
	L = sorted((k for (k, v) in C.items() if v > 1))
	return [x, L]


from collections import Counter

def find_dups_miss(arr):
	c = Counter(arr)
	return [next((i for i in range(min(c), max(c)) if i not in c)), sorted((x for x in c if c[x] > 1))]


def find_dups_miss(arr):
	(min_n, max_n) = (min(arr), max(arr))
	(seen, dupes) = (set(), set())
	for n in arr:
		if n in seen:
			dupes.add(n)
		else:
			seen.add(n)
	missing = (min_n + max_n) / 2.0 * (max_n - min_n + 1) - sum(seen)
	return [missing, sorted(dupes)]


def find_dups_miss(arr):
	from collections import Counter
	dup = sorted([i for (i, cnt) in Counter(arr).items() if cnt > 1])
	miss = list(set(range(min(arr), max(arr) + 1)) - set(arr))
	return [miss[0], dup]


from collections import Counter

def find_dups_miss(arr):
	cnt = Counter(arr)
	dup = sorted((x for x in cnt if cnt[x] >= 2))
	miss = (set(xrange(min(cnt), max(cnt) + 1)) - set(cnt)).pop()
	return [miss, dup]


import numpy as np

def find_dups_miss(arr):
	arr = sorted(arr)
	diff = np.array(arr[1:]) - np.array(arr[:-1])
	rep = [arr[i] for (i, x) in enumerate(diff) if x == 0]
	unico = [arr[i] + 1 for (i, x) in enumerate(diff) if x == 2]
	return [unico[0], rep]


def find_dups_miss(arr):
	a = sorted(arr)
	return [sum(range(a[0], a[-1] + 1)) - sum(set(a)), sorted(set(a[::2]) & set(a[1::2]))]