# SpeedCode #2 - Array Madness

## Objective

Given two **integer arrays** ```a, b```, both of ```length >= 1```, create a program that returns ```true``` if the **sum of the squares** of each element in ```a``` is **strictly greater than** the **sum of the cubes** of each element in ```b```.

E.g.
```python
array_madness([4, 5, 6], [1, 2, 3]) => True #because 4 ** 2 + 5 ** 2 + 6 ** 2 > 1 ** 3 + 2 ** 3 + 3 ** 3
```
Get your timer out.  Are you ready?  Ready, get set, GO!!!

Difficulty: EASY
Tags: Data structures

Ad-hoc
Skill types: Data structures

Starter code:
def array_madness(a,b):
	

Solutions:
def array_madness(a, b):
	return sum((x ** 2 for x in a)) > sum((x ** 3 for x in b))


def array_madness(a, b):
	return sum(map(lambda a: a ** 2, a)) > sum(map(lambda b: b ** 3, b))


def array_madness(a, b):
	sa = 0
	sb = 0
	for i in range(0, len(a)):
		sa += a[i] ** 2
	for i in range(0, len(b)):
		sb += b[i] ** 3
	return sa > sb


def array_madness(a, b):
	return True if sum([x ** 2 for x in a]) > sum([y ** 3 for y in b]) else False


def array_madness(a, b):
	return sum(map(lambda x: x * x, a)) > sum(map(lambda x: x * x * x, b))


def array_madness(a, b):
	squaresA = 0
	cubesB = 0
	for i in range(len(a)):
		squaresA += pow(a[i], 2)
	for j in range(len(b)):
		cubesB += pow(b[j], 3)
	return squaresA > cubesB


array_madness = lambda a, b: sum(map(lambda x: x ** 2, a)) > sum(map(lambda x: x ** 3, b))


def array_madness(a, b):
	return sum((a_i ** 2 for a_i in a)) > sum((b_i ** 3 for b_i in b))


array_madness = lambda a, b, nsum=lambda n, x: sum((e ** n for e in x)): nsum(2, a) > nsum(3, b)


array_madness = lambda a, b: sum((e ** 2 for e in a)) > sum((e ** 3 for e in b))


def array_madness(a, b):
	return sum((i ** 2 for i in a)) > sum((i ** 3 for i in b))


from typing import List

def array_madness(a: List[int], b: List[int]) -> bool:
	return sum(map(lambda _: pow(_, 2), a)) > sum(map(lambda _: pow(_, 3), b))


def array_madness(a, b):
	return sum(map(2.0.__rpow__, a)) > sum(map(3.0.__rpow__, b))


from functools import reduce

def array_madness(*arrays):
	return int.__gt__(*[reduce(lambda a, c: a + c ** (2 + i), a, 0) for (i, a) in enumerate(arrays)])


def array_madness(a, b):
	list1 = []
	list2 = []
	for i in a:
		list1.append(i ** 2)
	for j in b:
		list2.append(j ** 3)
	if sum(list1) > sum(list2):
		return True
	elif sum(list1) < sum(list2):
		return False
	elif sum(list1) == sum(list2):
		return True
	else:
		return True


def array_madness(*args):
	return int.__gt__(*(sum(map(i.__rpow__, arr)) for (i, arr) in enumerate(args, 2)))


def array_madness(a, b):
	return sum(map(square, a)) > sum(map(cube, b))

def square(x):
	return x * x

def cube(x):
	return x * x * x


def array_madness(a, b):
	s = lambda x, y: sum(list(map(lambda z: z ** y, x)))
	return s(a, 2) > s(b, 3)


def array_madness(arr1: list, arr2: list) -> bool:
	if len(arr1) and len(arr2) >= 1:
		return True if sum([i ** 2 for i in arr1]) > sum([i ** 3 for i in arr2]) else False
	return False


def array_madness(a, b):
	lista1 = []
	lista2 = []
	for num1 in a:
		num1 = num1 ** 2
		lista1.append(num1)
	add_lista1 = sum(lista1)
	for num2 in b:
		num2 = num2 ** 3
		lista2.append(num2)
	add_lista2 = sum(lista2)
	if add_lista1 > add_lista2:
		return True
	else:
		return False


def array_madness(a, b):
	resa = 0
	resb = 0
	for num in a:
		resa += num ** 2
	for num in b:
		resb += num ** 3
	return resa > resb


def array_madness(a, b):
	sq = 0
	sm = 0
	for i in a:
		sq += i ** 2
	for i in b:
		sm += i ** 3
	return sq > sm


def array_madness(a, b):
	farr = 0
	sarr = 0
	for i in a:
		n = i ** 2
		farr = farr + n
	for j in b:
		o = j ** 3
		sarr = sarr + o
	if farr > sarr:
		return True
	if sarr >= farr:
		return False


def array_madness(a, b):
	if sum(list(map(lambda x: x * x, a))) > sum(list(map(lambda x: x * x * x, b))):
		return True
	else:
		return False


def array_madness(a, b):
	aa = sum([i ** 2 for i in a])
	bb = sum([i ** 3 for i in b])
	print(aa, bb)
	return aa > bb


def array_madness(a, b):
	for i in range(len(a)):
		a[i] = a[i] ** 2
	sum_a = sum(a)
	for i in range(len(b)):
		b[i] = b[i] ** 3
	sum_b = sum(b)
	if sum_a > sum_b:
		return True
	else:
		return False


def array_madness(a, b):
	array1 = 0
	array2 = 0
	for v in a:
		array1 += v ** 2
	for v in b:
		array2 += v ** 3
	return array1 > array2


def array_madness(a, b):
	return sum([num ** 3 for num in b]) < sum([num ** 2 for num in a])


def array_madness(a, b):
	SumA = 0
	for number in a:
		SumA += number ** 2
	SumB = 0
	for number in b:
		SumB += number ** 3
	return SumA > SumB


def array_madness(a, b):
	a1 = 0
	b1 = 0
	for i in a:
		a1 += i ** 2
	for j in b:
		b1 += j ** 3
	return a1 > b1


def array_madness(a, b):
	suma = 0
	sumb = 0
	for i in a:
		suma += i * i
	for i in b:
		sumb += i * i * i
	return suma > sumb


def array_madness(a, b):
	squared = list(map(lambda x: x * x, a))
	cubed = list(map(lambda x: x * x * x, b))
	if sum(squared) > sum(cubed):
		return True
	return False


def array_madness(a, b):
	return sum(list(map(lambda elem: elem ** 2, a))) > sum(list(map(lambda elem: elem ** 3, b)))


def array_madness(a, b):
	a_list = 0
	b_list = 0
	for i in a:
		a_list = a_list + i ** 2
	for j in b:
		b_list = b_list + j ** 3
	if a_list > b_list:
		return True
	else:
		return False


def array_madness(a, b):
	x = 0
	for k in a:
		x += k ** 2
	y = 0
	for k in b:
		y += k ** 3
	if x > y:
		return True
	else:
		return False


def array_madness(a, b):
	print(a, b)
	sum1 = 0
	sum2 = 0
	for n in a:
		sum1 += n ** 2
	for n in b:
		sum2 += n ** 3
	print(sum1, sum2)
	if sum1 > sum2:
		return True
	else:
		return False


def array_madness(a, b):
	square = 0
	cube = 0
	for i in range(0, len(a)):
		square += a[i] ** 2
	for i in range(0, len(b)):
		cube += b[i] ** 3
	if square > cube:
		return True
	else:
		return False


def array_madness(a, b):
	result_a = 0
	result_b = 0
	for i in a:
		result_a += i ** 2
	for i in b:
		result_b += i ** 3
	return result_a > result_b


def array_madness(a, b):
	newa = []
	newb = []
	for x in a:
		newa.append(x ** 2)
	for y in b:
		newb.append(y ** 3)
	return sum(newa) > sum(newb)


def array_madness(a, b):
	suma = 0
	for i in a:
		suma = suma + i ** 2
	sumb = 0
	for i in b:
		sumb = sumb + i ** 3
	return suma > sumb


def array_madness(a, b):
	count = 0
	for item in a:
		a[count] = item ** 2
		count += 1
	count = 0
	for item in b:
		b[count] = item ** 3
		count += 1
	if sum(a) > sum(b):
		return True
	else:
		return False


def array_madness(a, b):
	sum1 = 0
	sum2 = 0
	for x in a:
		sum1 += x ** 2
	for x in b:
		sum2 += x ** 3
	if sum1 > sum2:
		return True
	else:
		return False


def array_madness(a, b):
	a_sqr = [x ** 2 for x in a]
	b_cub = [y ** 3 for y in b]
	a_sum = sum(a_sqr)
	b_sum = sum(b_cub)
	return True if a_sum > b_sum else False


def array_madness(a, b):
	sum1 = 0
	sum2 = 0
	for i in a:
		sq = i ** 2
		sum1 = sum1 + sq
	for j in b:
		cu = j ** 3
		sum2 = sum2 + cu
	if sum1 > sum2:
		return True
	else:
		return False


def array_madness(a, b):
	totalOfA = 0
	totalOfB = 0
	for number in a:
		newNumber = number ** 2
		totalOfA += newNumber
	for number in b:
		newNumber = number ** 3
		totalOfB += newNumber
	if totalOfA > totalOfB:
		return True
	else:
		return False


mul = lambda arr, h: sum((pow(i, h) for i in arr))
array_madness = lambda a, b: mul(a, 2) > mul(b, 3)


def array_madness(a, b):
	sum_of_a = 0
	sum_of_b = 0
	for x in range(len(a)):
		sum_of_a += a[x] ** 2
	for y in range(len(b)):
		sum_of_b += b[y] ** 3
	if sum_of_a > sum_of_b:
		return True
	else:
		return False


def ss(a):
	return sum([e * e for e in a])

def sc(b):
	return sum([e * e * e for e in b])

def array_madness(a, b):
	return ss(a) > sc(b)


def array_madness(a, b):
	squares = sum([el ** 2 for el in a])
	cubes = sum([el ** 3 for el in b])
	return squares > cubes


def array_madness(a, b):
	a_sum = 0
	b_sum = 0
	for i in a:
		a_sum = a_sum + i ** 2
	for j in b:
		b_sum = b_sum + j ** 3
	if a_sum > b_sum:
		return True
	else:
		return False


def square_array(arr):
	return [item ** 2 for item in arr]

def cube_array(arr):
	return [item ** 3 for item in arr]

def sum_array(arr):
	sum = 0
	for thing in arr:
		sum += thing
	return sum

def array_madness(a, b):
	return sum_array(square_array(a)) > sum_array(cube_array(b))


from functools import reduce

def array_madness(a, b):
	arr1 = map(lambda x: x ** 2, a)
	arr2 = map(lambda x: x ** 3, b)
	arr3 = reduce(lambda c, d: int(c) + int(d), arr1)
	arr4 = reduce(lambda e, f: int(e) + int(f), arr2)
	if arr3 > arr4:
		return True
	else:
		return False


def array_madness(a, b):
	result_a = 0
	result_b = 0
	for i in a:
		result_a += i ** 2
	for i in b:
		result_b += i ** 3
	return True if result_a > result_b else False


def array_madness(a, b):
	return sum((pow(el, 2) for el in a)) > sum((pow(el, 3) for el in b))


def array_madness(a, b):
	return True if sum([x ** 2 for x in a]) > sum([x ** 3 for x in b]) else False
array_madness([4, 5, 6], [1, 2, 3])


def array_madness(a, b):
	return True if sum((n ** 2 for n in a)) > sum((n ** 3 for n in b)) else False


def array_madness(a, b):
	la = sum((x ** 2 for x in a))
	lb = sum((y ** 3 for y in b))
	return la >= lb


def array_madness(a, b):
	square = [x ** 2 for x in a]
	cube = [x ** 3 for x in b]
	return sum(square) > sum(cube)


def array_madness(a, b):
	result1 = 0
	result2 = 0
	for number in a:
		result1 += number ** 2
	for number in b:
		result2 += number ** 3
	if result1 > result2:
		return True
	else:
		return False


def array_madness(a, b):
	kv = 0
	kub = 0
	for i in a:
		kv += i ** 2
	for j in b:
		kub += j ** 3
	return kv > kub


def array_madness(a, b):
	squares_list = [i ** 2 for i in a]
	cubes_list = [i ** 3 for i in b]
	return sum(squares_list) > sum(cubes_list)


def array_madness(a: [], b: []):
	result = 0
	result2 = 0
	for i in a:
		result += i * i
	for i in b:
		result2 += i * i * i
	if result > result2:
		return True
	return False


def array_madness(a, b):
	for i in range(len(a)):
		a[i] = a[i] ** 2
	suma = sum(a)
	for i in range(len(b)):
		b[i] = b[i] ** 3
	sumb = sum(b)
	if suma > sumb:
		return True
	else:
		return False


def array_madness(a, b):
	sum = 0
	sumc = 0
	for i in a:
		sum += i ** 2
	for i in b:
		sumc += i ** 3
	if sum > sumc:
		return True
	else:
		return False


def array_madness(a, b):
	sum1 = 0
	sum2 = 0
	for val1 in a:
		sum1 += val1 ** 2
	for val2 in b:
		sum2 += val2 ** 3
	return sum1 > sum2


def array_madness(a, b):
	q = 0
	w = 0
	for i in a:
		q += i ** 2
	for i in b:
		w += i ** 3
	return q > w


def array_madness(a, b):
	suma = 0
	sumb = 0
	for i in a:
		suma += i ** 2
	for j in b:
		sumb += j ** 3
	return True if suma > sumb else False


def array_madness(a, b):
	p = 0
	for i in a:
		p += i ** 2
	q = 0
	for j in b:
		q += j ** 3
	return p > q


def array_madness(a, b):
	c = False
	sum1 = list(map(lambda number: number * number, a))
	sum2 = list(map(lambda number: number * number * number, b))
	if sum(sum1) > sum(sum2):
		c = True
	return c


def array_madness(a, b):
	sum1 = 0
	sum2 = 0
	for i in range(len(a)):
		sum1 = sum1 + a[i] ** 2
	for j in range(len(b)):
		sum2 = sum2 + b[j] ** 3
	if sum1 > sum2:
		return True
	else:
		return False


def array_madness(a, b):
	return sum((_a ** 2 for _a in a)) > sum((_b ** 3 for _b in b))


def array_madness(a, b):
	a_total = 0
	b_total = 0
	for i in a:
		x = i * i
		a_total += x
	for i in b:
		x = i * i * i
		b_total += x
	return a_total > b_total


def array_madness(a, b):
	hi = 0
	cool = 0
	for num in a:
		p1 = num ** 2
		cool = p1 + cool
	for i in b:
		p2 = i ** 3
		hi = p2 + hi
	if cool > hi:
		return True
	else:
		return False


def array_madness(a, b):
	r = lambda arr, p: sum([number ** p for number in arr])
	return r(a, 2) > r(b, 3)


def array_madness(squares, cubes):
	return sum((num ** 2 for num in squares)) > sum((num ** 3 for num in cubes))


def array_madness(a, b):
	for (i, v) in enumerate(a):
		a[i] = v ** 2
	for (i, v) in enumerate(b):
		b[i] = v ** 3
	return sum(a) > sum(b)


def array_madness(a, b):
	temp = 0
	temp1 = 0
	for i in range(len(a)):
		temp += a[i] ** 2
	for j in range(len(b)):
		temp1 += b[j] ** 3
	if temp > temp1:
		return True
	else:
		return False


def array_madness(a, b):
	squareSum = 0
	cubeSum = 0
	for i in a:
		squareSum += i * i
	for i in b:
		cubeSum += i * i * i
	if squareSum > cubeSum:
		return True
	return False


def array_madness(a, b):
	x = 0
	y = 0
	for i in a:
		x += i * i
	for j in b:
		y += j * j * j
	return x > y


def square(x):
	return x * x

def Cube(x):
	return x * x * x

def array_madness(a, b):
	return (True, False)[sum(map(square, a)) < sum(map(Cube, b))]


def array_madness(a, b):
	a_total = 0
	b_total = 0
	for num in a:
		squares = num ** 2
		a_total = a_total + squares
	for num in b:
		cubes = num ** 3
		b_total = b_total + cubes
	return a_total > b_total


def calculate_array(array, exponent):
	result = 0
	for i in range(len(array)):
		result += array[i] ** exponent
	return result

def array_madness(a, b):
	(sum_a, sum_b) = (calculate_array(a, 2), calculate_array(b, 3))
	if sum_b < sum_a:
		return True
	return False


def array_madness(a, b):
	lsta = []
	lstb = []
	for x in a:
		x = x ** 2
		lsta.append(x)
	for y in b:
		y = y ** 3
		lstb.append(y)
	if sum(lsta) >= sum(lstb):
		return True
	else:
		return False


def array_madness(a, b):
	res1 = 0
	for i in a:
		res1 = res1 + i * i
	res2 = 0
	for i in b:
		res2 = res2 + i * i * i
	return res1 >= res2


def array_madness(a, b):
	x = 0
	y = 0
	for i in a:
		x += i ** 2
	for c in b:
		y += c ** 3
	return x > y


def array_madness(a, b):
	Listea = list()
	Listeb = list()
	for ch in a:
		Listea.append(ch ** 2)
		suma = sum(Listea)
	for ch in b:
		Listeb.append(ch ** 3)
		sumb = sum(Listeb)
	if suma > sumb:
		return True
	else:
		return False


def array_madness(a, b):
	x = y = i = 0
	for i in range(len(a)):
		x = x + a[i] * a[i]
	for i in range(len(b)):
		y = y + b[i] * b[i] * b[i]
	return x > y


def array_madness(a, b):
	one = sum([i ** 2 for i in a])
	two = sum([i ** 3 for i in b])
	return one > two


def array_madness(a, b):
	sum_a = sum((x ** 2 for x in a))
	sum_b = sum((x ** 3 for x in b))
	if sum_a > sum_b:
		return True
	else:
		return False


def array_madness(a, b):
	sum_squares = 0
	sum_cubes = 0
	for number in a:
		sum_squares += number ** 2
	for number in b:
		sum_cubes += number ** 3
	if sum_squares > sum_cubes:
		return True
	return False


def array_madness(a, b):
	return sum((i * i for i in a)) > sum((w * w * w for w in b))


def array_madness(a, b):
	return sum((n * n for n in a)) > sum((n * n * n for n in b))


import numpy as np

def array_madness(a, b):
	(a, b) = (np.array(a), np.array(b))
	squaring_array1 = a ** 2
	cube_array2 = b ** 3
	if sum(squaring_array1) > sum(cube_array2):
		return True
	else:
		return False


def array_madness(a, b):
	a_squares = [i ** 2 for i in a]
	b_cubes = [i ** 3 for i in b]
	return sum(a_squares) > sum(b_cubes)