You are viewing a single comment's thread. Return to all comments →
hello, this is really weird. This solution scores 100% Yet if you test it with inputs : 5 2 1 1 1 5 It should return 5, and yet it returns 0
def solve(arr): left = [] right = [] n = len(arr) for i,e in enumerate(arr): if i==0 or e>= arr[i-1]: left.append(0) else: left.append(i) if i== n-1 or e>=arr[i + 1]: right.append(0) else: right.append(i+2) return max([left[i]*right[i] for i in range(n)])
Seems like cookies are disabled on this browser, please enable them to open this website
Find Maximum Index Product
You are viewing a single comment's thread. Return to all comments →
hello, this is really weird. This solution scores 100% Yet if you test it with inputs : 5 2 1 1 1 5 It should return 5, and yet it returns 0