Untitled
unknown
plain_text
a year ago
413 B
7
Indexable
var maxArea = function(height) { let i = 0; let j = height.length - 1; let map = new Map(); while(i < j){ map.set(Math.min(height[i], height[j]) * (j - i)) if(height[i] < height[j]){ i++; } else{ j--; } } map = Array.from(map.keys()).sort((a,b) => b[0] - a[0]); console.log(map) return map };
Editor is loading...
Leave a Comment