Try these questions: 🔥 Daily Temperatures kzbin.info/www/bejne/mH7VlHWarLebaLc, 🔥 Next Greater Element I kzbin.info/www/bejne/jGbVaIOHnch9ebM 🔥 Largest Rectangle in Histogram kzbin.info/www/bejne/qHzaq6N3ecmjobs 🔥 Complete playlist: kzbin.info/aero/PLEI-q7w3s9gQpqrVq_9VkYugtILlqSB1I
@nitinkumar59742 жыл бұрын
unique thing about your lectures is that your lectures are very short and very easy to understand Thanks
@rounakjoshi66802 жыл бұрын
Bro U deserve 1e9 likes for explaining this question.⚡⚡⚡⚡⚡⚡
@saranghae3720 Жыл бұрын
Easy, Short, Clean & Concise Explanation
@CodeWithSunchitDudeja Жыл бұрын
Glad you liked it
@nikhilprakash7292 ай бұрын
Great Explanation Sir..
@shrimpo6416 Жыл бұрын
Quality video as always, thank you! (not very hard after learning all questions in your mono stack sheet by heart, thank you for sharing!)
@topG4487 ай бұрын
The brute force of this problem is 0(N^2)
@noedie49732 жыл бұрын
thanks a lot, got the intuition initally but was intimidated by the pre-prefix thing and couldn't solve, nicely explained here!
@CodeWithSunchitDudeja2 жыл бұрын
Glad it helped!
@ashisranjandey75417 ай бұрын
Short and crisp and sound. Great explanation, Man .. Kudos.
@paragroy535911 ай бұрын
Nice video. Great Content, keep on making such videos.
@pavniujla6542 жыл бұрын
Best explanation on youtube, the way you explain nobody else call
@aryanjain76452 жыл бұрын
nice explanation!
@tanmaychanda398 Жыл бұрын
I'm not able to understand the multiplication part , can someone make me understand that?
@amarbudhiraja32102 жыл бұрын
nice explaination!
@m.ohammadalikhan Жыл бұрын
Why have you taken the size of preSum and prePrefix array as n+1 and n+2? Why not just n?
@hymnish_you2 жыл бұрын
Thank you ❤
@CodeWithSunchitDudeja2 жыл бұрын
You're welcome 😊, glad seeing your message after long
@hymnish_you2 жыл бұрын
@@CodeWithSunchitDudeja Feeling good that you know your subscribers well. Such a humble person you are :)
@nakshatrasharma90222 жыл бұрын
Great explanation, variable(stacks) naming could be a little better, but good job overall. Cheers!
@Bloggerrusrb2 жыл бұрын
thank you!
@CodeWithSunchitDudeja2 жыл бұрын
You're welcome!
@aleksandrg27172 жыл бұрын
thank you
@CodeWithSunchitDudeja2 жыл бұрын
You're welcome
@sanketnaik3872 жыл бұрын
Is it for those who have learnt DSA?
@CodeWithSunchitDudeja2 жыл бұрын
True.. if you don't know DSa don't solve it it will break your confidence
@sanketnaik3872 жыл бұрын
@@CodeWithSunchitDudeja Yeah bhaiya. I am a college fresher currently and DSA is in my 3rd semester but I have just started learning it. Although the code was tough to grasp which you wrote but the way you broke the problem was very nice. It was just like our Math teacher making us understand permutations and combination.
@CodeWithSunchitDudeja2 жыл бұрын
@@sanketnaik387 thanks that u liked it...
@manishsakariya45952 жыл бұрын
Sum(L+1,i) = Prefix[i+1] - prefix[L+1] is right? try with 1,2,3,4,5,6 sum(2,5) = prefix[6]-prefix[2] = 21-3 = 19 [According to above formula?] which is wrong. 2+3+4+5=14
@reenaupadhyay92182 жыл бұрын
I also have this doubt.. shouldn't it be Sum(L+1,i) = prefix[I] - prefix[L+1 - 1]??
@himadrinath15025 ай бұрын
yes it is wrong sum(L+1,i)=prefix(i+1)-prefix(L)
@arnabmishra96382 жыл бұрын
Great explanation
@CodeWithSunchitDudeja2 жыл бұрын
Glad it was helpful!
@inimace2 жыл бұрын
In test case [1,3,1,2] Won't the sub array 1,3,1 counted twice when minimum element is 1 (at index 0) and 1 (at index 2) ?
@ritabrotoganguly57292 жыл бұрын
that's why you have to use >= for left and > for right or vice versa
@cwmayank2 жыл бұрын
Hi, I think code shared by you failed for 81/82 (may be because of mod). I always hate taking mod because sometimes it give errors that I can't debug. Anyway, thank you so much for making video on this question. You're videos are always short and to the point. Please keep making such videos. 1 Request - Could you please make videos on past contests of leetcode on daily basis. No need to give the code even the intuition will do. A lot of beginners like me suffer while practicing previous leetcode challenges because there are not good videos on them. Thanks again............
@CodeWithSunchitDudeja2 жыл бұрын
Here is the complete playlist: kzbin.info/aero/PLEI-q7w3s9gRwAEYzYkvVTsYHDi2-ffdL
@ashwinigautam10032 жыл бұрын
link for monotonic stack ??
@CodeWithSunchitDudeja2 жыл бұрын
Try these questions: 🔥 Daily Temperatures kzbin.info/www/bejne/mH7VlHWarLebaLc, 🔥 Next Greater Element I kzbin.info/www/bejne/jGbVaIOHnch9ebM 🔥 Largest Rectangle in Histogram kzbin.info/www/bejne/qHzaq6N3ecmjobs 🔥 Complete playlist: kzbin.info/aero/PLEI-q7w3s9gQpqrVq_9VkYugtILlqSB1I
@Siddharth19242 жыл бұрын
fails the last test case on lc
@suhasnayak47042 жыл бұрын
Just add +MOD at the end in this line ans += ((prePrefix[right[i]+1] - prePrefix[i+1]) * (i-left[i]) % MOD + MOD - (prePrefix[i+1] - prePrefix[left[i]+1]) * (right[i] - i) % MOD)*strength[i] + MOD;
@deepanprakash43622 жыл бұрын
kzbin.info/www/bejne/gWSUh4B7apt_adE sum(L+1, i) should be Prefix(i)- prefix(L) , how it is Prefix(i+1)-Prefix(L+1) , for ex: 1, 8,7,3 (L, L+1, i, i+1) here sum(8,7) should be Prefix(7)-Prefix(1) = 16-1 but in your example Prefix(i+1)-Prefix(L+1) => 19-9 = 10 which is wrong, can you please explain?
@anupamasingh12392 жыл бұрын
All test case didn't pass
@suhasnayak47042 жыл бұрын
Just add +MOD at the end in this line ans += ((prePrefix[right[i]+1] - prePrefix[i+1]) * (i-left[i]) % MOD + MOD - (prePrefix[i+1] - prePrefix[left[i]+1]) * (right[i] - i) % MOD)*strength[i] + MOD;
@mrprime5572 жыл бұрын
Took way too much time to understand :') makes me feel dumb af
@LegitGamer23452 жыл бұрын
Nice explanation !
@CodeWithSunchitDudeja2 жыл бұрын
Great seeing your message after long.. hope you are doing fine