← Back to challenges

Maximum and Minimum Product Triplets

PythonHardnumbersarrays

Instructions

Write two functions:

  1. One that returns the maximum product of three numbers in a list.
  2. One that returns the minimum product of three numbers in a list.

Examples

max_product([-8, -9, 1, 2, 7]) ➞ 504

max_product([-8, 1, 2, 7, 9]) ➞ 126

min_product([1, -1, 1, 1]) ➞ -1

min_product([-5, -3, -1, 0, 4]) ➞ -15

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.