summaryrefslogtreecommitdiff
path: root/progs/a310.py
diff options
context:
space:
mode:
Diffstat (limited to 'progs/a310.py')
-rw-r--r--progs/a310.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/progs/a310.py b/progs/a310.py
new file mode 100644
index 0000000..09962eb
--- /dev/null
+++ b/progs/a310.py
@@ -0,0 +1,4 @@
+def maximum_product(nums):
+ import heapq
+ a, b = heapq.nlargest(3, nums), heapq.nsmallest(2, nums)
+ return max(a[0] * a[1] * a[2], a[0] * b[0] * b[1]) \ No newline at end of file