function(e){let t=0,r=e.length-1,i=0;for(;t<r;)i=Math.max(i,Math.min(e[t],e[r])*(r-t)),e[t]<=e[r]?t+=1:r-=1;return i}

result

49