blob: 117ceeb388af073b0d24ca46f1967888f58af0d4 (
plain)
1
2
3
4
5
6
7
8
9
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)
|