00:00:00 - Intro 00:00:03 - Stack implementation, medium to hard level questions 00:03:15 - Doubt support, structured courses, 00:06:40 - Stack implementation for finding smaller elements in an 00:12:18 - Finding next/previous smaller element, largest 00:16:56 - Loop, area, optimization, stack, 00:23:05 - max area, problem with next, prev created using timestampgenius
@@sde77 actually there are some standard algorithms that we have to remember there's no way you can always solve all the questions all by yourself in the first go.
Completed bhaiya, now I feel confident in stack and recursion I'm only able to understood recursion bcoz of you ❤.. like how to approach a recursion problem or how to convert an iterative solution to a recursive one. Thank you so much bhaiya Will try to reach tree by Sunday.
We need Handwritten Notes rest of Lectures, It's really time savings. When we have to revise, then I think all of us use that beautiful Notes. Otherwise it again a long time to see video again.
Bahut hi badhiya video bhaiya/sir !! Love the way ki aap kaise pehle ek related question solve karwaate ho, taaki hum log wo idea main question me laga sake :)
Algo 2 : 1. Will keep going right untill we get bigger or equal height rectangle. So max width for that triangle can be next-prev-1. (Prev can be -1 in can case of no smaller rectangle on left side ) 2. For this formula to be valid the next has to be greater than 0 otherwise 3 or 2 negatives can make width/breadth in negative which is not right
How did that code run in ques 1. If we take a case in which arr=[5,6,2,1,-2] here arr[n-1]=curr=-2 and s.top()=-1 so s.top()>arr[i] hene while loop would run and s.pop() pops out the only element in the stack hence stack is empty then how ans[i] gets -2 store in it
19 ms code for first que , yaha while loop k place pe direct i++ krde to complexity kam ho jati hai .....stack s; s.push(-1); for(int i=n-1;i>=0;i--) { int z= arr[i]; if(s.top()
if the array contains negative no this algo will fail., {,2,1,3,-5} ,in first iteration of while loop, -1>=-5 so -1 will be popped then stack will be empty but while loop will still run for -5 as there is nothing left in stack, segmentation fault will occur, correct me if i am wrong.
Already bohot load hai bhaiya pe yaar..full time job, teaching consistently, maintaing discord, networking to get more teachers to teach other subjects,etc..pehle ye khatam kar lene do 🙂
Brute force for Largest Area of rectangle - class Solution { public: int largestRectangleArea(vector& heights) { int maxArea = 0; for(int i = 0;i= 0){ while(heights[j]>=heights[i] && j>=0){ width++; if(j>0){ j--; } else{ break; } } } int k = i + 1; if(k < heights.size()){ while(heights[k] >= heights[i] && k
what will be the ans in next smaller element in case of [5,1,4,3,10,2]. here is the problem with your approach, at when we'll find next smaller for element 4 at that time stack has two smaller element than 4. stack would be like [3,2,-1] and s.top() will be = 3. then how to deal with this case ? @codeHelp
Video in AfterNoon😍😍 Bhaiya plz make a *Roadmap for internship { 5 months left } with DSA busted course as resource* 💥😍 {2nd Year Students} #BeliveInBabbar 😍
Can we do it this way ? , first we will sort individual rectangles in order (increasing height), so that we don’t have to check the previous rectangle,
Sorry but this was a little fast and so some concepts did not hit well ...usually this does not happen .. but I felt it today ....
Nah bro even I watched it in 1.25x don't worry bro just be consistent you will able learn everything one day
bro watch it on 0.5x...!😅
skill issue
@@appy4401 tmhare me bahut skill hai to video kyu dekhne aae. BC kam pela karo beta.
Keep posting, the content is seriously amazing. Awesome work rate! Eagerly waiting for the advanced dsa concepts such as tree graph etc.
Literally, the best course on DSA.
Thankyou bhaiya.✨
00:00:00 - Intro
00:00:03 - Stack implementation, medium to hard level questions
00:03:15 - Doubt support, structured courses,
00:06:40 - Stack implementation for finding smaller elements in an
00:12:18 - Finding next/previous smaller element, largest
00:16:56 - Loop, area, optimization, stack,
00:23:05 - max area, problem with next, prev
created using timestampgenius
It took me to watch this video twice, but the histogram problem is best explained by you bro, THANKS :)
Bhaiyya You Are Doing great work Thank You Bhaiyya For everything All Concept are crystal clear till this thank you for next level consistancy❤️
i have understood the code, but like how in the world can we think of this approach if we have not seen such question before?
yes, so did you get any insight regarding this bro. Please tell me
@@sde77 actually there are some standard algorithms that we have to remember there's no way you can always solve all the questions all by yourself in the first go.
@@deeksha-cm8kq what are those algorithm
Completed bhaiya, now I feel confident in stack and recursion
I'm only able to understood recursion bcoz of you ❤.. like how to approach a recursion problem or how to convert an iterative solution to a recursive one. Thank you so much bhaiya Will try to reach tree by Sunday.
tree ho gaya??
@@xreesh hn
We need Handwritten Notes rest of Lectures, It's really time savings.
When we have to revise, then I think all of us use that beautiful Notes.
Otherwise it again a long time to see video again.
@Uttam Kesarwani Please make you own notes
Check slide links in description
Q1 mein jo 2nd approach hain usmein bhi toh Time Complexity O(n^2) hogi kyuki FOR Loop ke andar WHILE Loop use kiya hain .
@Vishwesh_ Well, I would have appreciated if you would have simply explained about time complexity instead of commenting your stupidity.
Keep Working and Keep believing myself that i can do this and trying to match your consistancy everyday.
Present sir✌🏻 enjoying the series !!Great work sir💯💯
I was stuck on this lecture from two days finally I have completed it.I am so happy.
Bro you teach really good!!! Though i code in java , but ur explanation is suitable for any language. Thank You so much for these videos.
you can also store the smallest element in an integer while filling the stack and push ("smallest" or "-1") as the condition demands
Bahut hi badhiya video bhaiya/sir !! Love the way ki aap kaise pehle ek related question solve karwaate ho, taaki hum log wo idea main question me laga sake :)
Algo 2 :
1. Will keep going right untill we get bigger or equal height rectangle. So max width for that triangle can be next-prev-1. (Prev can be -1 in can case of no smaller rectangle on left side )
2. For this formula to be valid the next has to be greater than 0 otherwise 3 or 2 negatives can make width/breadth in negative which is not right
There is still a better approach in Striver's channel
Har video mein at least 2-3 Leetcode ke Medium se Hard level wale questions zarur karwao aur length 45 min se 1 hr tak jaane do.
Really helpful !!. I tried doing the histogram problem just after the 1st problem and solved it in one Go
you are amazing babbar bhaiya !!!!!!
Seriously best course on DSA. Keep posting such amazing content 💯
Thanks a lot Love Bhai!! This series is really helpful for us.
Your efforts are next level man!
💯💯
bhaiyya apka content bohot accha hai , bass thoda clear bola karo , kuch words aap jaldi jaldi me boldete ho toh samajh nahi aate ....
Bhaiya loop ke ander while loop hai to time complexity jese n^2 hui
Please comment
Thank you so much bhaiya! Consistency OP 😇😊✨
Sir , aptitude and resonaning series kab se start hogi approx date reply sir 🙏🏾🙏🏾
It's Giving Confidence
This is my 5-6 video and finally got it.🤩
How did that code run in ques 1. If we take a case in which arr=[5,6,2,1,-2] here arr[n-1]=curr=-2 and s.top()=-1 so s.top()>arr[i] hene while loop would run and s.pop() pops out the only element in the stack hence stack is empty then how ans[i] gets -2 store in it
Constraints me arr[i] >= 0 diya hua hai
God level consistency 🙌🙌
Amazing question with amazing explanation ❤..... Undoubtedly, pretty good course than anyone
Op explanation bhaiya ❤ Hard problem ko ekdam easy bana dia 🔥
Present bhaiya!!! Awesome series and consistency ♥️♥️
TBH, best dsa on youtube 🔥
19 ms code for first que , yaha while loop k place pe direct i++ krde to complexity kam ho jati hai .....stack s;
s.push(-1);
for(int i=n-1;i>=0;i--)
{
int z= arr[i];
if(s.top()
wahh bhaiyaa mzaa aa gyaa...hats off to you bhaiyaa..keep it up for ourself...
awesome ..........
waiting for dp and backtracking .✌
Present bhaiyya... 🤩 Great consistency
are bhaiya tu si great ho .. it takes time to me understand bt your explanation is superb
Thank you ❤️ bhaiya.. consistency OP.. ❤️
not explained well striver's explanation is quite good though
Consistency op🔥🔥
Reach++
Bhai approximately kitne total lecture honge
if the array contains negative no this algo will fail., {,2,1,3,-5} ,in first iteration of while loop, -1>=-5 so -1 will be popped then stack will be empty but while loop will still run for -5 as there is nothing left in stack, segmentation fault will occur, correct me if i am wrong.
yes. but according to question, height can't be negative😅
@@04_abhishekpandey37 i was talking about first quesn, now i get it for first quesn it is given array contains +ve no only
@@shreyansh-s ooh okay cool👍
Then you have to push INT_MIN initially in the stack instead of -1.
Thoda thoda doubt hai per dry run se hoo jayega ❤ thanku Bhaiya maja aa gya
this next greater elements code will not work for 1 3 4 2................plz try
Ye toh meine socha hi ni,,, Nice Approach bhaiya and well explained !!!!
love u bhaiya ❤️❤️❤️
great hardwork bhai, thanks for everything ❤️
Best se bhi best 😊😊
This is just AWESOME . Enjoyed it.
🔥🔥🔥❣awesome playlist on youTube.
Never seen before.
awesome content sir
love you bhaiya for you best content
brute force :-
int maxArea = 0;
for(int i = 0; i=0 && arr[k] >= arr[i] )
{
currArea = currArea + arr[i];
k--;
}
maxArea = max(maxArea , currArea);
}
return maxArea;
consistency on peak. tahnk you bhaiya
Bhaiya morning 4-5 am ko aap kuch start krne wale the na questions solve krne ka , please krdo shuru , hum bhi solve karenge aapke sath , ek Poll share krdo phir decide Krna start Krna ya nhi, please bhaiya 🙂❤️
Already bohot load hai bhaiya pe yaar..full time job, teaching consistently, maintaing discord, networking to get more teachers to teach other subjects,etc..pehle ye khatam kar lene do 🙂
Thank you so much for all your efforts.
really u explained in a very great way thank you:)
#include
vector nextSmallerElement(vector &arr, int n)
{
/*
//BRUTE FORCE
for(int i=0;i
thoda sa fast hogai iss video
Hello , Bhiya thanks you for your lovely teaching and guidance...
Mei abhi lecture no. 14 pr hui...apko thanks karne ke liye es video pr click kiya⭐
best solution i have ever found
thank you bhaiya,understood the concept very well
not understande last question using stack histogram but i do this using brot forse aprroch
thanks
Bhai you are using while loop in for loop how it can O(n) it is O(n^2) time complexity
Brute force for Largest Area of rectangle -
class Solution {
public:
int largestRectangleArea(vector& heights) {
int maxArea = 0;
for(int i = 0;i= 0){
while(heights[j]>=heights[i] && j>=0){
width++;
if(j>0){
j--;
}
else{
break;
}
}
}
int k = i + 1;
if(k < heights.size()){
while(heights[k] >= heights[i] && k
Why is time complexity O(n) only in Question 1 ?
I also have this confusion. jab for loop me while agya, to O(n) nhi hona chahiye tha.
You are doing an awesome work Bhai!. Hope to get a good placement soon.
what will be the ans in next smaller element in case of [5,1,4,3,10,2]. here is the problem with your approach, at when we'll find next smaller for element 4 at that time stack has two smaller element than 4. stack would be like [3,2,-1] and s.top() will be = 3. then how to deal with this case ?
@codeHelp
in the second approach time complexity id o(n^2) an
Present bhaiya!!! Thank you so much
understood
Hard level karwa diya.....maza aagaya bhaiya
Loving the series.
bhaiya area vaala thoda samajha nhi but baki sab thik h ,do tin baar dekhta ho aajeyaga
some amt of time ab done hota h aur clear bhi lage raho
Loving the content
Thank You So Much BHRATA SHREE !!!!!!!
bhaiya aap jo questions karate ho vo hame pehle try karna hai ya aap ki video dekhne ke bad karna hai plz ans dena bahaut confusion hai
aaj hi lec 55 complete kiya now watching todal lec 56
maga aa gaya bhaiya question solve karnai mei
One new pen color is introduced in this video.....
Bhaiya aap lagbhag 200 videos banana DSA par aesa course pure TH-cam jagat par nahi hoga
❤❤❤ best'est' dsa lec..
Every person who ask me how to start coding and also ask about best dsa channel i just say search dsa by love babbar🔥🔥
Literallly, the god level Consistency
present ++
BEST explanation as always❤🔥
12:41 Of course chalega, 44 minutes pehle bhi toh kiya tha. 😂
hey! bro while doing any question how to know that the question will solve using stack ??
IMO, if we are able to judge that the latest result is required first, we can opt for stack.
thank u so much for your 450 qs dsa sheet
great concepts got easily
bhaiya done with today`s lecture .. waiting for another one .. stack ko faad dena hai
Great Maza agaya..kya step by step utha kar samjhaye ho bhaiya....pehla next small and prev small ka hi game tha..Great explanation.
Best explanation Thanks Bhya
Attendance marked bhaya Love u 🙈🙈🙈🙈🙈🙈
Video in AfterNoon😍😍
Bhaiya plz make a *Roadmap for internship { 5 months left } with DSA busted course as resource* 💥😍
{2nd Year Students}
#BeliveInBabbar 😍
bhai kaha intern laga?
@@sachin-ll1by 2 month nhi lagi thi 🤣🤣 6 month lag gyi
@@unboxtheuniverse5336 congo... Kis company me?
Can we do it this way ? , first we will sort individual rectangles in order (increasing height), so that we don’t have to check the previous rectangle,
no if there is a 0 between two heights then we get wrong ans.[2,0,2]
Very GOOD BHAIYA
ekdam badiya bhaiya
mazaa aa gaya👍👍🤩🤩🤩🤩🤩🤩🤩🤩🙏🙏
Great explanation sir💥