Baby is getting his frst tooth. This means more sleepless nights, but with the fun of feeling round his gums and trying to guess which will be first out! 

Probably best have a sweepstake with your friends - because you have the best chance of knowing. You can feel the gums and see where the raised bits are - most raised, most likely tooth to come through first!

Given an array of numbers (t) to represent baby's gums, you need to return the index of the lump that is most pronounced. 

The most pronounced lump is the one that has the biggest differential to its surrounding values. e.g.:

```
[1, 2, 4] = 2

index 0 has a differential of -1 to its right (it is lower so the figure is negative)

index 1 has a differential of +1 to its left, and -2 to its right. Total is -1.

index 2 has a differential of +2 to its left, and nothing to its right, 
```

If there is no distinct highest value (more than one occurence of the largest differential), return -1.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Starter code: def first_tooth(array):
	

Solutions:
def first_tooth(lst):
	gums = lst[:1] + lst + lst[-1:]
	diff = [gums[i + 1] * 2 - gums[i] - gums[i + 2] for i in range(len(lst))]
	m = max(diff)
	return diff.index(m) if diff.count(m) == 1 else -1


def first_tooth(array):
	array = [array[0]] + array + [array[-1]]
	diffs = [2 * array[i] - array[i - 1] - array[i + 1] for i in range(1, len(array) - 1)]
	m = max(diffs)
	if diffs.count(m) > 1:
		return -1
	else:
		return diffs.index(m)


def first_tooth(xs):
	diff = [(x - xs[i - 1] if i > 0 else 0) + (x - xs[i + 1] if i + 1 < len(xs) else 0) for (i, x) in enumerate(xs)]
	x = max(diff)
	if diff.count(x) > 1:
		return -1
	return diff.index(x)


def first_tooth(arr):
	l = len(arr)
	lst = [(arr[i] - arr[i - 1] if i else 0) + (arr[i] - arr[i + 1] if i < l - 1 else 0) for i in range(l)]
	m = max(lst)
	return lst.index(m) if lst.count(m) == 1 else -1


def first_tooth(array):
	if len(array) <= 1:
		return 0
	differentials = []
	differentials.append(array[0] - array[1])
	for i in range(1, len(array) - 1):
		differentials.append(2 * array[i] - array[i - 1] - array[i + 1])
	differentials.append(array[-1] - array[-2])
	if differentials.count(max(differentials)) > 1:
		return -1
	else:
		return differentials.index(max(differentials))


import numpy as np
from scipy import ndimage

def first_tooth(a):
	d = ndimage.convolve(a, [-1, 2, -1], mode='nearest')
	m = np.argwhere(d == d.max())
	return m[0][0] if len(m) == 1 else -1


def first_tooth(array):
	if len(array) == 1:
		return 0
	else:
		max_diff = -1
		max_diff_indices = []
		i = 0
		while i < len(array):
			if i == 0:
				diff = array[i] - array[i + 1]
			elif i == len(array) - 1:
				diff = array[i] - array[i - 1]
			else:
				diff = array[i] - array[i - 1] + array[i] - array[i + 1]
			if diff > max_diff:
				max_diff = diff
				max_diff_indices = [i]
			elif diff == max_diff:
				max_diff_indices.append(i)
			i += 1
		if len(max_diff_indices) > 1:
			return -1
		else:
			return max_diff_indices[0]


def first_tooth(some_list):
	answer_list = []
	if len(some_list) == 1:
		return some_list.index(max(some_list))
	else:
		answer_list.append(some_list[0] - some_list[1])
		for i in range(1, len(some_list) - 1):
			answer_list.append(some_list[i] - some_list[i - 1] + (some_list[i] - some_list[i + 1]))
		answer_list.append(some_list[len(some_list) - 1] - some_list[len(some_list) - 2])
		if answer_list.count(max(answer_list)) > 1:
			return -1
		return answer_list.index(max(answer_list))


def first_tooth(array):
	a = [array[0]] + array + [array[-1]]
	b = [2 * a[i] - a[i - 1] - a[i + 1] for i in range(1, len(a) - 1)]
	c = max(b)
	return b.index(c) if b.count(c) == 1 else -1