You will be given an array which lists the current inventory of stock in your store and another array which lists the new inventory being delivered to your store today.

Your task is to write a function that returns the updated list of your current inventory **in alphabetical order**.

## Example

```python
cur_stock = [(25, 'HTC'), (1000, 'Nokia'), (50, 'Samsung'), (33, 'Sony'), (10, 'Apple')]
new_stock = [(5, 'LG'), (10, 'Sony'), (4, 'Samsung'), (5, 'Apple')]

update_inventory(cur_stock, new_stock)  ==>
[(15, 'Apple'), (25, 'HTC'), (5, 'LG'), (1000, 'Nokia'), (54, 'Samsung'), (43, 'Sony')]
```

___

*Kata inspired by the FreeCodeCamp's 'Inventory Update' algorithm.*

Difficulty: EASY
Starter code: def update_inventory(cur_stock, new_stock):
	

Solutions:
from collections import defaultdict

def update_inventory(cur_stock, new_stock):
	answer = defaultdict(int)
	for (stock, item) in cur_stock + new_stock:
		answer[item] += stock
	return [(answer[item], item) for item in sorted(answer)]


from collections import defaultdict

def update_inventory(cur_stock, new_stock):
	stock = defaultdict(int, [(k, v) for (v, k) in cur_stock])
	for (v, k) in new_stock:
		stock[k] += v
	return [(v, k) for (k, v) in sorted(stock.items())]


def update_inventory(cur_stock, new_stock):
	updated_stock = []
	stock = []
	brands = []
	tmpBrands = []
	for i in cur_stock:
		brands.append(i[1])
	for j in new_stock:
		if j[1] not in brands:
			brands.append(j[1])
	brands.sort()
	tmpBrands = brands.copy()
	print(tmpBrands)
	for i in cur_stock:
		for j in new_stock:
			if i[1] == j[1]:
				stock.append((i[0] + j[0], i[1]))
				tmpBrands.remove(i[1])
	for i in cur_stock:
		if i[1] in tmpBrands:
			stock.append(i)
			tmpBrands.remove(i[1])
	for j in new_stock:
		if j[1] in tmpBrands:
			stock.append(j)
			tmpBrands.remove(j[1])
	i = 0
	while len(stock):
		for j in brands:
			for k in stock:
				if j == k[1]:
					updated_stock.append(k)
					stock.remove(k)
					break
		i += 1
	return updated_stock


from collections import defaultdict

def update_inventory(prv_stock, add_stock):
	new_stock = defaultdict(int, (item[::-1] for item in prv_stock))
	for (qty, prod) in add_stock:
		new_stock[prod] += qty
	return [item[::-1] for item in sorted(new_stock.items())]


from collections import Counter

def update_inventory(cur_stock, new_stock):
	C1 = Counter({v: k for (k, v) in cur_stock})
	C2 = Counter({v: k for (k, v) in new_stock})
	return [(v, k) for (k, v) in sorted((C1 + C2).items())]


from collections import Counter

def update_inventory(cur_stock, new_stock):
	c = Counter({key: value for (value, key) in cur_stock}) + Counter({key: value for (value, key) in new_stock})
	return [(c[key], key) for key in sorted(c)]


def update_inventory(cur_stock, new_stock):
	cur_stock_dict = {key: value for (value, key) in cur_stock}
	for (value, key) in new_stock:
		cur_stock_dict[key] = cur_stock_dict.get(key, 0) + value
	return [(cur_stock_dict[key], key) for key in sorted(cur_stock_dict)]


from collections import Counter
revertToDct = lambda lst: Counter(dict((x[::-1] for x in lst)))

def update_inventory(*stocks):
	(old, new) = map(revertToDct, stocks)
	return [it[::-1] for it in sorted((old + new).items())]


def update_inventory(cur_stock, new_stock):
	d = {}
	for (i, j) in cur_stock + new_stock:
		d[j] = d.get(j, 0) + i
	return sorted([(j, i) for (i, j) in d.items()], key=lambda x: x[1])


from functools import reduce
from collections import Counter

def update_inventory(cur_stock, new_stock):
	return sorted([(v, k) for (k, v) in reduce(lambda x, y: x + y, [Counter({k: v for (v, k) in x}) for x in [cur_stock, new_stock]]).items()], key=lambda x: x[1])