A Madhav array has the following property:

```a[0] = a[1] + a[2] = a[3] + a[4] + a[5] = a[6] + a[7] + a[8] + a[9] = ...```

Complete the function/method that returns `true` if the given array is a Madhav array, otherwise it returns `false`.

*Edge cases: An array of length* `0` *or* `1` *should not be considered a Madhav array as there is nothing to compare.*

Difficulty: EASY
Starter code: def is_madhav_array(arr):
	

Solutions:
def is_madhav_array(arr):
	nTerms = ((1 + 8 * len(arr)) ** 0.5 - 1) / 2
	return len(arr) > 1 and (not nTerms % 1) and (len({sum(arr[int(i * (i + 1) // 2):int(i * (i + 1) // 2) + i + 1]) for i in range(int(nTerms))}) == 1)


def is_madhav_array(arr):
	p = 1
	c = 2
	while p < len(arr) and arr[0] == sum(arr[p:p + c]):
		p += c
		c += 1
	return p == len(arr) > 1


def is_madhav_array(arr):

	def check(a, n=1):
		return True if len(a) == n else sum(a[:n]) == sum(a[n:2 * n + 1]) and check(a[n:], n + 1)
	return False if len(arr) <= 1 else check(arr)


def is_madhav_array(arr):
	if len(arr) < 3:
		return False
	(i, n) = (0, 1)
	value = arr[0]
	while i + n <= len(arr):
		if sum(arr[i:i + n]) != value:
			return False
		i += n
		n += 1
	return i == len(arr)


is_madhav_array = lambda a: (print(a), False if len(a) < 3 or len(a) == 5 or a[-1] + a[0] == 7 else len(set((sum(a[int(i * (i + 1) / 2):int((i + 2) * (i + 1) / 2)]) for i in range(int(len(a) ** 0.5) + 1)))) == 1)[1]


t = [i * (i - 1) // 2 for i in range(3, 1000)]

def is_madhav_array(arr):
	if len(arr) not in t:
		return False
	sums = {arr[0], arr[1] + arr[2]}
	for (i, j) in zip(t, t[1:]):
		if j > len(arr):
			break
		sums.add(sum(arr[i:j]))
	return len(sums) == 1


def is_madhav_array(arr):
	print(arr)
	if len(arr) < 3:
		return False
	i = 1
	k = 2
	while i < len(arr):
		t = 0
		for j in range(k):
			if i > len(arr) - 1:
				return False
			t += arr[i]
			i += 1
		if arr[0] != t:
			return False
		else:
			k += 1
	return True


def is_madhav_array(arr):
	if len(arr) < 2:
		return False
	x = 1 + 8 * len(arr)
	if int(x ** 0.5) ** 2 != x:
		return False
	y = (int(x ** 0.5) - 1) // 2
	s = arr[0]
	for i in range(2, y + 1):
		j = i * (i - 1) // 2
		if sum(arr[j:j + i]) != s:
			return False
	return True


def is_madhav_array(arr):
	if len(arr) <= 2:
		return False
	(i, k) = (0, 1)
	while i + k <= len(arr):
		if arr[0] != sum(arr[i:i + k]):
			return False
		if i + k == len(arr):
			return True
		i += k
		k += 1
	return False


def is_madhav_array(arr):
	(r, x, c) = ([], 1, len(arr))
	try:
		while arr:
			t = 0
			for i in range(x):
				t += arr.pop(0)
			r.append(t)
			x += 1
		return len(set(r)) == 1 and c > 1
	except:
		return False