This video i watched a year ago definitely got me my job now in my final year. You taught so well i was able to recollect every approach from this. So thanks a ton.
The best part of his videos is: he explains from starting tells all expected approaches and their disadvantages and finally tells approach that will give the correct answer and then gives the solution. Hats off!!!!
Man, Teacher's day never made sense to me before but now after watching these videos, my thinking has changed completely. If teachers in India can focus on developing the thought process in students rather than just completing the syllabus and getting their students in merit list, a lot can change in the country.
Great video. Damn amazing. You can't imagine what great service you are delivering. I get the idea and I even figure out the whole code in between the video. This is the sign of a great teacher. He just need to give a sign to the student, and the rest becomes a story. You gave me the true picture of what is APPROACH. Otherwise, I was just understanding the idea of the problem or just memorizing how to solve it. You are a CODING GOD.
Bro i really wish i found out about u sooner currently 6th sem passed and watching ur videos for recap......best teacher by far! Mad respect bhaiya!:))
Aadi bhai you rock yarr.. !! Bhai aapka teaching style todd hai.. ek baar dekhte hi sab samaz aata hai.. bahot dua lagne wali hai aapko sabki.. You doing a commendable job..!! Hats off yarr..!! I hated DS Algo kyunki mujhe bahot tough lagta tha ye sab.. pr ab nahi.. sala kash kisine aisa angle dikhaya hota pehle.. I love solving problems now and successfully able to find patterns in it. Thanks, man..!! Keep up the good work..!! Waiting for more..!! God bless.. :-)
Thanks brother !! Such long comments always put a smile across my face ❤️✌️✌️ Also Do share the content amomg your friends and collage to help the channel grow !! Thanks for watching again !!
Today I got selected in Flipkart all because of your videos Aditya! Besides learning technical stuff, I got to learn from you on how to handle and approach complex problems. Thanks a lot! I really owe you a lot, can't msg on LinkedIn since you haven't accepted my request but I'm gonna ping you as soon as I join to thank you :)
Very good approach Of breaking down water level at each building level. Minor enhancement: the last loop just to calculate sum can be eliminated. You can instead keep adding to sum right after you calculate water level at index i. sum += water[i]; // after calculating water[i]
leetcode solution for reference - for noobies like me !! int trap(vector& arr) { int n =arr.size(); vector right_max(n); vector left_max(n); // no matter what we can't store water on edge buildings left_max[0]=arr[0]; for(int i=1;i=0;i--){ right_max[i]=max(arr[i],right_max[i+1]); } int sum=0; for(int i=1;i
in case someone needs a java solution: class Solution { public int trap(int[] height) { int n = height.length; int[] maxL = new int[n]; int[] maxR = new int[n];
maxL[0] = height[0]; for(int i = 1; i < n; i++){ maxL[i] = Math.max(maxL[i-1], height[i]); } maxR[n-1] = height[n-1]; for(int i = n-2; i >= 0; i--){ maxR[i] = Math.max(maxR[i+1], height[i]); }
Thanks a lot for the awesome explanation. I was able to code only by listening to the explanation without seeing the solution. Please keep this channel organic with such content unlike others who at a later stage adulterate their channel with ads and shortcut videos.
👏 Never thought DSA could be so much interesting and easy to learn. These aren't easy problems but hats off to you, after seeing your explanation it's a piece of cake ✌
Sir i am being your big fan saala puri duniya patani lakhon kharch karke lecture video suit kar raha he aur bhai apna ek page aur mobile phone se unn sabki le raha he.. God Bless bhai.. Love you..
bhai jitni tarif karu utni kam hai kya content share karte ho aap , ye channel god ka gift hai mere liye aur Aditya verma ( vishnu avatar hai mere life ke liye )
Arreyy ni bhai, kaha Vishnuji aur kaha me 😅 Michael Faraday kese bnna hai bs wo bta do 😂✌️ jokes apart, Thanks for such a beautiful comment, Love you brother 😅✌️
Yaar mera to dhyaan bhatak jaata hai ...beech beech may pause kar k bs dil pe haath rakh k hsate rehta hun......kitniiii ppyaari hai ye.... lekin han bahot achcha pdhati hai jenny mam
Good Explanation Programming Lord! But Bro, please create the remaining ones in the list, really appreciate your hard work for explaining the concepts. I wished my DSA teacher be like you.
Commendable work of finding patterns and categorising problems. When will you be adding the last four problems of the list you shared in the beginning of the playlist?
Thanks Aditya . Constant space - O(1). and single loop solution - O(n) void max_water(int A[], int n) { int l = 0, h = n - 1; int left_max = 0; int right_max = 0; int ans[n] = {0}; while (l = right_max) { right_max = A[h]; } else ans[h] = right_max - A[h]; h--; } } for (int i = 0; i < n; i++) { cout
can you please help me ? I wrote the whole code but it is giving me segmentation fault , i cant find where is the mistake #include #include #include using namespace std; #include int trap(vector& height) { vectormaxl; vectormaxr; maxl[0]=height[0]; for ( int i =1;i=0;i--) { maxr[i]=max(maxr[i+1],height[i]); } vectorwater; for ( int i =0;i
There is O(1) space complexity solution to it. This is indeed related to NGL just nearest is changed to farthest. In fact there is no need of stack in NGL, you can just use the same technique to compare with ngl(previous).
I don't think we can say this as farthest greater to left: suppose this is the array: 6 8 0 0 5 9 6 for element=5 max in the left array is 8 max in the right array is 9 min of both is 8 water accumulated on element =5 is 8-5=3. which is correct. But, farthest greater to left is 6 farthest greater to right is 9 min is 6 water accumulated is 6-5 =1, which is wrong
can you please help me ? I wrote the whole code but it is giving me segmentation fault , i cant find where is the mistake #include #include #include using namespace std; #include int trap(vector& height) { vectormaxl; vectormaxr; maxl[0]=height[0]; for ( int i =1;i=0;i--) { maxr[i]=max(maxr[i+1],height[i]); } vectorwater; for ( int i =0;i
awesome sir, koi word nhi hai apki tarrif krna ka bss jaab selection honne ke baad sweet lekr faculty k pass too pta nhi jaoga ya nhi but appke pass jurur aaoga :-)
no doubt , he gave an amazing explanation, but we didn't used stack in this solution, then what's the point of adding this question in the stack playlist?
This problem clearly identifies stack . as we go maxleft and maxright element comparing to the current element. So seen the full video and disappointed by not using stack. So I implemented the Stack-based approach its is similar to NGL and NGR but little modifications need to be done.and also similar to above video approach but below code uses stack and above code uses max(arr[i],max[i-1]); Note:-All my knowledge is acquired from Aditya verma's channel. JAVA CODE class Solution{ // arr: input array // n: size of array // Function to find the trapped water between the blocks. static int trappingWater(int arr[], int n) { int sum=0; int maxright[]=maxRight(arr,n); int maxleft[]=maxLeft(arr,n); for(int i=0;i=0;i--) { if(st.peek()
we don't really need to implement stack in this problem if we use stack our space complexity increases without any benefit so we can just do it using traversing and creating two array instead of stack
faltu ka oversmart bann raha hai jaise koi reimann hypothesis ka solution nikal diya ho, jab jarurat nahi hai stack ki aur O(1) space mein bhi hoskta hai toh faltu mein stack kyu ghusedna hai, push pop push pop karne mein maza arha h kya terko
Apke video ko bc kaun bewakoof insaan dislike kar raha hai Kitne acche padha rahe ho aap Aapko jitna like diye toh bhi kam padega THANK YOU BHAYYA!! Keep helping us
This video i watched a year ago definitely got me my job now in my final year. You taught so well i was able to recollect every approach from this. So thanks a ton.
Great explanation, and u r right jenny mam is pretty😂
right? You feel me ? !! 😂😂😂😂😂😂😂😂😂😂😂
@@TheAdityaVerma yup😂🙏, waiting for ur videos though
@@TheAdityaVerma awaaz bhi unka kitna pyaara hai
@@TheAdityaVerma hahhah
haha she is theory teacher. whenever i see her video i thought seh never coded in her whole life.
Jenny kafi achchha padati hai +sunder bhi dikhti hai!
Koi kinta bhi achcha DSA karle aakhir meh rehata engineer he hai 😂😂
men will be men...sargam lolol
😂😂
Exam me pass hone ke liye jada tar padhte hai
15:50 we understand the double meaning laughter 😂😂😂
😂😂😂😂😂.... Are are sir 😭😭😭😂😂😂
kaise pani nikal na hai
jenny ka pani
The best part of his videos is:
he explains from starting
tells all expected approaches and their disadvantages
and finally tells approach that will give the correct answer
and then gives the solution.
Hats off!!!!
2:12 "dekhna hai to jaaker JENNY k lecture dekho dikhti bhi sundar hai aur acha bhi padhati hai"
Has a separate fanbase in my college
Volume is very low sir please try to keep it a little more 😅
bhaii boats ke headphones se hi sunai de rha merko
Thanks for this comment, else I would consider this class as mute!
Man, Teacher's day never made sense to me before but now after watching these videos, my thinking has changed completely. If teachers in India can focus on developing the thought process in students rather than just completing the syllabus and getting their students in merit list, a lot can change in the country.
Great video. Damn amazing. You can't imagine what great service you are delivering. I get the idea and I even figure out the whole code in between the video. This is the sign of a great teacher. He just need to give a sign to the student, and the rest becomes a story. You gave me the true picture of what is APPROACH. Otherwise, I was just understanding the idea of the problem or just memorizing how to solve it. You are a CODING GOD.
You are right 😁
Bro how can i use pair in java ?? Actually I am in doubt
Bro i really wish i found out about u sooner currently 6th sem passed and watching ur videos for recap......best teacher by far!
Mad respect bhaiya!:))
Where did you get placed?
Aadi bhai you rock yarr.. !!
Bhai aapka teaching style todd hai.. ek baar dekhte hi sab samaz aata hai.. bahot dua lagne wali hai aapko sabki..
You doing a commendable job..!! Hats off yarr..!!
I hated DS Algo kyunki mujhe bahot tough lagta tha ye sab.. pr ab nahi.. sala kash kisine aisa angle dikhaya hota pehle.. I love solving problems now and successfully able to find patterns in it. Thanks, man..!!
Keep up the good work..!! Waiting for more..!! God bless.. :-)
Thanks brother !! Such long comments always put a smile across my face ❤️✌️✌️
Also Do share the content amomg your friends and collage to help the channel grow !! Thanks for watching again !!
@@TheAdityaVerma Needless to say.. already shared and received a lot of praise for sharing..!! :D :P
Thanks a ton !!
@@TheAdityaVerma bro thoda jor se bola kr pls..
Today I got selected in Flipkart all because of your videos Aditya!
Besides learning technical stuff, I got to learn from you on how to handle and approach complex problems.
Thanks a lot!
I really owe you a lot, can't msg on LinkedIn since you haven't accepted my request but I'm gonna ping you as soon as I join to thank you :)
apna LinkedIn ka profile do to
@@crajeducation6733 😂😂
@@crajeducation6733nhi laga lagta hai
Aditya sir is in flipkart too. Hope you get to meet him
Very good approach Of breaking down water level at each building level.
Minor enhancement: the last loop just to calculate sum can be eliminated. You can instead keep adding to sum right after you calculate water level at index i.
sum += water[i]; // after calculating water[i]
bhai ye toh stack ka sawal tha hi nhi
Aditya sir ke aagey mahaanta dikhaaega neech aadmi, jaa jaake ppap dho ganga mein
leetcode solution for reference - for noobies like me !!
int trap(vector& arr) {
int n =arr.size();
vector right_max(n);
vector left_max(n);
// no matter what we can't store water on edge buildings
left_max[0]=arr[0];
for(int i=1;i=0;i--){
right_max[i]=max(arr[i],right_max[i+1]);
}
int sum=0;
for(int i=1;i
Thanks
in case someone needs a java solution:
class Solution {
public int trap(int[] height) {
int n = height.length;
int[] maxL = new int[n];
int[] maxR = new int[n];
maxL[0] = height[0];
for(int i = 1; i < n; i++){
maxL[i] = Math.max(maxL[i-1], height[i]);
}
maxR[n-1] = height[n-1];
for(int i = n-2; i >= 0; i--){
maxR[i] = Math.max(maxR[i+1], height[i]);
}
int[] water = new int[n];
for(int i = 0; i
Sir, you said you would add the remaining videos later in the playlist. So can you please add them? They are really helping us. Thanks a lot.
sir please complete the series , it is much needed. Hats off to your explanation ! if possible add queue playlist also
15:52 that 😈 smile...😁😁😁
Nobody can explain like you. Your explanations makes hardest problem to the easiest problem. Thanks for that
Thanks a lot for the awesome explanation. I was able to code only by listening to the explanation without seeing the solution. Please keep this channel organic with such content unlike others who at a later stage adulterate their channel with ads and shortcut videos.
Bhaiya on fire....jenny sundar b lagti h
you nailed it!!! I liked the way you have broken the problem down and the concept of maxleft and maxright, awesome, thanks a lot!!!
15:52😅😂
🙊🙊😂😂
😂
"Apne ko kya hai, apne ko toh bas paani nikaalna hai" 🤣
👏 Never thought DSA could be so much interesting and easy to learn. These aren't easy problems but hats off to you, after seeing your explanation it's a piece of cake ✌
Sir i am being your big fan
saala puri duniya patani lakhon kharch karke lecture video suit kar raha he aur bhai apna ek page aur mobile phone se unn sabki le raha he.. God Bless bhai.. Love you..
bhai jitni tarif karu utni kam hai kya content share karte ho aap ,
ye channel god ka gift hai mere liye aur Aditya verma ( vishnu avatar hai mere life ke liye )
Arreyy ni bhai, kaha Vishnuji aur kaha me 😅 Michael Faraday kese bnna hai bs wo bta do 😂✌️
jokes apart, Thanks for such a beautiful comment, Love you brother 😅✌️
This video helped me in solving the leetcode question of Rain water trapping. Thanks alot!
2:10 had me going 😂😂😂
kaafi achi padathi hai aur sundar bhi dikthi hai..😂😂
Yaar mera to dhyaan bhatak jaata hai ...beech beech may pause kar k bs dil pe haath rakh k hsate rehta hun......kitniiii ppyaari hai ye....
lekin han bahot achcha pdhati hai jenny mam
fuck off.. Aditya Verma is best
Good Explanation Programming Lord! But Bro, please create the remaining ones in the list, really appreciate your hard work for explaining the concepts. I wished my DSA teacher be like you.
I love your explanation sir
can't thankyou enough for these videos, I can't believe I am able to code faster only by understanding the approach.
15:45 so , apne ko smj aa gya ki kese Pani nikal skte h ..😂😂 anyone noticed that he laughed at that moment 😅😅
2:10 yaha boss bhi pighal gye 😂
Commendable work of finding patterns and categorising problems. When will you be adding the last four problems of the list you shared in the beginning of the playlist?
waitingggggg
15:51 his laugh after "tho hame samajh a gaya ki hm kaise paani nikal skte h" Ture engineers😂😂 🙌
Great explanation and Jenny sundar bhi dikhti h savage 😂😂😂😂
Was confuse with this example
1,0,2,0,1,3,1
best explanation 🥳
aditya bhai, tum ho to sb h, vrna kch bhi nhi. dil se dhanyawaad
jenny achha padhati h aur sundar bhi dikhti h🤣🤣🤣🤣
2:14 bhaiya op😂😂
Bhaiya mooj kara di 🔥🔥🔥 maza aagaya
Bhai appse aacha koi nahi padtha TH-cam pe ♥️
2:10 comment on jenny was awesome 😎😎😂😂😂😂😂😂😂😂
"Vo accha pdhati hai, sundar bhi dikhti hai" was heart touching🤣🤣
What an explanation 😊
amazing!....jenny ahhhh kyaa baat
15:48 kese pani nikal sakte he , and that laughter explains all 😂😂
And jenny sundar h 🤣🤣🤣
brother please complete the series by uploading 4 more questions that you gave in your 1 video of stack
Explanation was really amazing, but where did we use stack.
Thanks Aditya .
Constant space - O(1). and single loop solution - O(n)
void max_water(int A[], int n)
{
int l = 0, h = n - 1;
int left_max = 0;
int right_max = 0;
int ans[n] = {0};
while (l = right_max)
{
right_max = A[h];
}
else
ans[h] = right_max - A[h];
h--;
}
}
for (int i = 0; i < n; i++)
{
cout
Is it the dp solution??
@@kirtikhohal3313 Dp can not be done without memoisation. This is greedy ig..
2:13😂😂
😅
Bahut sundar😂
The current solution is O(N), O(N) for time and space complexity respectively. A more optimized solution exists using constant extra space O(N), O(1).
can you please help me ? I wrote the whole code but it is giving me segmentation fault , i cant find where is the mistake
#include
#include
#include
using namespace std;
#include
int trap(vector& height) {
vectormaxl;
vectormaxr;
maxl[0]=height[0];
for ( int i =1;i=0;i--)
{
maxr[i]=max(maxr[i+1],height[i]);
}
vectorwater;
for ( int i =0;i
areeey you're the best ..i can binge watch your videos
Get a life
GOD BLESS YOU BHAI
Great explanation Sir!
wow great problem, solved excellents, there's little maths involved but yea great explanation.
"jenny kafi acha padhati hai aur sundar bhi dikhti hai"
Loved your way of explaining .
when are you releasing backtracking playlist?
It took him 3 years
15:46 ,me as a kid when friend told me about homework folder.
Suberb explanation😊
Finally Understood, Thank you Bhaiyya !!
you are OP aditya Bhai...jenny wala dialouge
There is O(1) space complexity solution to it.
This is indeed related to NGL just nearest is changed to farthest.
In fact there is no need of stack in NGL, you can just use the same technique to compare with ngl(previous).
how we can solve it in O(1) ??
I don't think we can say this as farthest greater to left:
suppose this is the array: 6 8 0 0 5 9 6
for element=5
max in the left array is 8
max in the right array is 9
min of both is 8
water accumulated on element =5 is 8-5=3. which is correct.
But, farthest greater to left is 6
farthest greater to right is 9
min is 6
water accumulated is 6-5 =1, which is wrong
Now are the days when i search about any topic then i type this -> rain water trapping aditya verma... #God
15:50 Bro didn't even hesitate!! 😂😂
15:46 We all know why he laughed
one line for Jenny 😂
kaafi acha pdhati hai and sundar bhi dikhti hai 😂
Sundar bhi dikhti hai woh😂🥰🥰
sunder bhi dikhti hai who😂, But you are the best!
You are doing great job. aditya. Thanks man.
itna acche se explain kiya hai. dhanyawaad.
can you please help me ? I wrote the whole code but it is giving me segmentation fault , i cant find where is the mistake
#include
#include
#include
using namespace std;
#include
int trap(vector& height) {
vectormaxl;
vectormaxr;
maxl[0]=height[0];
for ( int i =1;i=0;i--)
{
maxr[i]=max(maxr[i+1],height[i]);
}
vectorwater;
for ( int i =0;i
Thanks sir , please keep uploading as these are very useful videos.
awesome sir, koi word nhi hai apki tarrif krna ka bss jaab selection honne ke baad sweet lekr faculty k pass too pta nhi jaoga ya nhi but appke pass jurur aaoga :-)
Attitude tabar tor hai bhai sahi hai dikhra hai kis level ka preparation hai aur really approach kafi different aur accurate hai
You will very soon have 1M subscribers.
Waiting eagerly for your backtracking playlist. Please release it soon.
Still Waiting for Tree,Graph, Backtracking...
Bhai apko jab bhi time mile to inki video series bana ke upload kr dena🙏🙏🙏
was expecting the approach using stack. It's nowhere in the utube. DP approach is explained by everyone as it is easy.
no doubt , he gave an amazing explanation, but we didn't used stack in this solution, then what's the point of adding this question in the stack playlist?
Amazing explanation sir ,you make this problem a lot easy
Btw very good concept i understand through this ❤️❤️
15:52 That Laughter 😂
This problem clearly identifies stack . as we go maxleft and maxright element comparing to the current element. So seen the full video and disappointed by not using stack. So I implemented the Stack-based approach its is similar to NGL and NGR but little modifications need to be done.and also similar to above video approach but below code uses stack and above code uses max(arr[i],max[i-1]);
Note:-All my knowledge is acquired from Aditya verma's channel.
JAVA CODE
class Solution{
// arr: input array
// n: size of array
// Function to find the trapped water between the blocks.
static int trappingWater(int arr[], int n) {
int sum=0;
int maxright[]=maxRight(arr,n);
int maxleft[]=maxLeft(arr,n);
for(int i=0;i=0;i--)
{
if(st.peek()
we don't really need to implement stack in this problem if we use stack our space complexity increases without any benefit so we can just do it using traversing and creating two array instead of stack
faltu ka oversmart bann raha hai jaise koi reimann hypothesis ka solution nikal diya ho, jab jarurat nahi hai stack ki aur O(1) space mein bhi hoskta hai toh faltu mein stack kyu ghusedna hai, push pop push pop karne mein maza arha h kya terko
Jenny kafi achchha padati hai +sunder bhi dikhti hai!
Sir aapka crush hai sayad😂
Tum log badnaam mt kro be, 😂😂 tum logo interest aaye isliye bola tha yaar, yaha to backfire ho gya 😕😅
Explanation is really good but i didn't see stack in this problem
2:10 bro said it
Add link to problem in your videos.
TY for the amazing tutorials.
God sir🔥🔥
Nice explaination !!
there is no word for what this channel is providing
Bhai or SB topic pe videos dalo na .... Bhut Shi samjh Mai aata tumhari video se
So apne ko smjh m aagya ki hm kaise paani nikaal skte h 😂😂at 15:48 😂😂
samshj me agya kaise pani nikalna hai
thanks bhaiya for such a wonderfull explanation
Apke video ko bc kaun bewakoof insaan dislike kar raha hai
Kitne acche padha rahe ho aap
Aapko jitna like diye toh bhi kam padega
THANK YOU BHAYYA!!
Keep helping us
jenny fan honge :)
15:48 that silent laugh :D
I have no words... : ) : D
Sir, please upload videos on graph problems: DFS, shortest paths, SCC
those who learned " pani kaise nikalte hai".....like the video
has pada tha bhai apna
kya baat hai sir jenny ma'am toh kuch zyada hi sundar nikli