Largest Rectangle in Histogram | Live Coding with Explanation | Leetcode - 84

preview_player
Показать описание
To support us you can donate

Check out our other popular playlists:

If you find any difficulty or have any query then do COMMENT below. PLEASE help our channel by SUBSCRIBING and LIKE our video if you found it helpful.

#coding #leetcode #programminglife #programmingisfun #programmer #tech #software #codinglife #leetcode
Рекомендации по теме
Комментарии
Автор

We hope you all are enjoying our videos!!! Don't forget to leave a comment!!! Please like the video to support us!!!

Questions you might like:

Struggling in a question??

Leave in a comment and we will make a video!!!🙂🙂🙂

AlgorithmsMadeEasy
Автор

if the input is in increasing order, the stack solution will provide any output. example [1, 2, 3, 4] as the currentHeight will always be greater then the previous height in the stack. Please take a look.

TanmayJoshi
Автор

i think first approach will take o(n^2) when the left[prev] = prev-1 (for wrost case),

sainathreddy
Автор

Maam in One test case is not working [2, 2]

ashishyadav-zvyo
Автор

Animation is good but explanation is not upto the level for me ...

kushagrakulshrestha
Автор

class Solution {
public int largestRectangleArea(int[] heights) {
int n=h.length;
int maxArea=0;
stack<Integer> s= new stack<>();
for(int i=0;i<+n;I++){
int currHeight=i==n?0:h[i];

int top=s.pop();
int
int area=h[top]*width;
maxArea=Math.max(area, maxArea);
}
s.push(i);
}
return maxArea
}
}

ashishyadav-zvyo
join shbcf.ru