unozerocode / exercises

Various algorithm exercises and a list of books
Mozilla Public License 2.0
0 stars 1 forks source link

Largest product of 3 elements #31

Open unozerocode opened 4 years ago

unozerocode commented 4 years ago

You are given an array of integers. Return the largest product that can be made by multiplying any 3 integers in the array.

Example:

[-4, -4, 2, 8] should return 128 as the largest product can be made by multiplying -4 -4 8 = 128.

Here's a starting point:

def maximum_product_of_three(lst):
# Fill this in.

print maximum_product_of_three([-4, -4, 2, 8])
128