You are viewing a single comment's thread. Return to all comments →
function largestRectangle(h: number[]): number { let max = 0 h.push(0) for (let i = 0; i < h.length; i++) { let curH = h[i], curW = 1 for (let j = i+1; j < h.length; j++) { if (h[j] < curH) { max = Math.max(max, curH * curW) if (!(curH = h[j])) break } curW++ } } return max }
Seems like cookies are disabled on this browser, please enable them to open this website
Largest Rectangle
You are viewing a single comment's thread. Return to all comments →