summaryrefslogtreecommitdiff
path: root/progs/a831.py
diff options
context:
space:
mode:
Diffstat (limited to 'progs/a831.py')
-rw-r--r--progs/a831.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/progs/a831.py b/progs/a831.py
new file mode 100644
index 0000000..117ceeb
--- /dev/null
+++ b/progs/a831.py
@@ -0,0 +1,10 @@
+def max_product(arr, n ):
+ mpis =[0] * (n)
+ for i in range(n):
+ mpis[i] = arr[i]
+ for i in range(1, n):
+ for j in range(i):
+ if (arr[i] > arr[j] and
+ mpis[i] < (mpis[j] * arr[i])):
+ mpis[i] = mpis[j] * arr[i]
+ return max(mpis) \ No newline at end of file