Stacks : Interview Questions | Leetcode Problems | Lecture 55 | Java and DSA Course

  Рет қаралды 78,601

College Wallah

College Wallah

Күн бұрын

Пікірлер: 86
@Danishalam1555
@Danishalam1555 5 ай бұрын
sir u are world greatest teacher aapse padh ke kabhi bhi bore nhi hote h chahe wo lecture kitne bhi ghnte ka kyu na ho aapse ek reqest hai aap please tree ka lectue laiye aur is dsa series ko continue kigiye
@Aman-dh9wz
@Aman-dh9wz 4 ай бұрын
Pw website pe hai video bhai .
@siddharthasingh6680
@siddharthasingh6680 Жыл бұрын
Sir, It's a request. After completing this series please make videos on miscellaneous questions so that we get an idea how to find which data structure to use in which question.
@manishdhekane5393
@manishdhekane5393 11 ай бұрын
In depth explanation Thanks for this amazing lecture.
@ShachiSinghal-fi6uh
@ShachiSinghal-fi6uh Жыл бұрын
I hope one day, I can also think whole logic on my own.
@great.Indian.culture
@great.Indian.culture 3 ай бұрын
It will come in future sure if u feel it today.
@deevyanshutiwari1855
@deevyanshutiwari1855 19 күн бұрын
Q5) In while condition write like this -> while(st.size()>0 && st.peek()
@AnanyaShukla-z6r
@AnanyaShukla-z6r Жыл бұрын
1:14:57 in ques 5 it shoud be while(st.size()>0 && st.peek()
@inspirationknowledge728
@inspirationknowledge728 Жыл бұрын
I detect this error by chatgpt
@subhadeeppaul1751
@subhadeeppaul1751 11 ай бұрын
Brother, I have faced this issue also...Can You explain it little bit, because I'm little bit confused with this issue.
@Sun_shINE0905
@Sun_shINE0905 11 ай бұрын
dekh agar stack ka size zero hogaya hoga toa peek kareaga toa error aayga na,isliye phele he check kar le ki kahi zero toa nahi hai@@subhadeeppaul1751
@mvenkataadityaprakash9485
@mvenkataadityaprakash9485 8 ай бұрын
Since if we do as the sir is doing then we are performing operations on the stack without knowing the size(for suppose if the size is zero and you are again trying to pop the element when there is no element in the stack so that's why we have to do like this hope you like it !!!!!!@@subhadeeppaul1751
@deekshithapendela1760
@deekshithapendela1760 5 ай бұрын
@@subhadeeppaul1751 suppose if our stack is empty and we are peeking the top element then it will give error saying that stack is empty thts y we added another condition making sure that stack is not empty while peeking the element.
@tricksforsolving2804
@tricksforsolving2804 5 ай бұрын
1:47:02 gfg class Solution { // Function to calculate the span of stock’s price for all n days. public static int[] calculateSpan(int price[], int n) { // Your code here Stack st=new Stack(); int res[]=new int[price.length]; res[0]=1; st.push(0); for(int i=1;i0 && price[st.peek()]
@unlocksmile
@unlocksmile Жыл бұрын
Etna achha koi sikha nahi sakta
@ShachiSinghal-fi6uh
@ShachiSinghal-fi6uh Жыл бұрын
Tapping rainwater was also tough.
@jeetukumar9148
@jeetukumar9148 Жыл бұрын
Sir please trees krana ab queqe ke baad,aapki wjh se DSA me mja aa rha h
@ayaaniqbal3531
@ayaaniqbal3531 Жыл бұрын
Thank you sir.Your videos are very helpful.😊
@arjcreators3474
@arjcreators3474 Жыл бұрын
million times🙇‍♀ thanks sir
@sangamsaini138
@sangamsaini138 Жыл бұрын
homework count wrong brackets public static int count(String str) { Stack stack = new Stack(); int ans = 0; for (int i = 0; i < str.length(); i++) { char ch = str.charAt(i); if(ch=='('){ stack.push(ch); } else{ if(stack.isEmpty()){ ans+=1; }else{ stack.pop(); } } } ans+=stack.size(); return ans; }
@akashgautam583
@akashgautam583 Жыл бұрын
int arr[] = {1,2,3,3,3,3,4,4,4,2,2,5,5,7,8} is not working. it's give ans only 1,7,8 but according to questions ans should be 1,2,7,8.. Please Discuss in next lecture.. Lecture is awesome...❤ Please reduce the time gap between uploading two consecutive lectures...
@itzMysterious17
@itzMysterious17 Жыл бұрын
Iska answer Mila??
@Abhaykumar-lw7nr
@Abhaykumar-lw7nr Ай бұрын
sir please continue the course like :: TREE ,GRAPH , etc....🙏🙏🙏
@parthsaboo7832
@parthsaboo7832 Жыл бұрын
sir Q4 ka solution agr suppose array esa hua {1,2,2,1,3,10} toh answer expected toh 1,1,3,10 hoga but aayega 3,10 aapke code ke hisaab se.
@harshalwadne8519
@harshalwadne8519 Жыл бұрын
1,1,3,10 hi ayega bro coz we need to find consecutive sub sequence so in that sequence only 2 is repeating twice
@gayatripansare7980
@gayatripansare7980 9 ай бұрын
Yes, wrong ans ayega .
@codebyprince4562
@codebyprince4562 Жыл бұрын
Maza aa Gaya Bhaiya...❤
@dcn467
@dcn467 Жыл бұрын
2:53:21 Mistake 😮😮 if we push 5 ,2,4,6 then min stack should be 5,2,2,4 but it will give 5,2,2,4
@sheetalsharma1675
@sheetalsharma1675 Жыл бұрын
super sir stay blessed
@aarzumustafa4586
@aarzumustafa4586 Жыл бұрын
public class Main { public static boolean balanceOrNot(String str) { int n = 0; for (int i = 0; i < str.length(); i++) { if (str.charAt(i) == '(') n++; else n--; } if (n == 0) return true; else return false; } public static void main(String[] args) { System.out.println(balanceOrNot("(()())")); } }
@maestro_Edikts_
@maestro_Edikts_ Жыл бұрын
)()() yeh string balanced todi h?
@sakshitiwari1869
@sakshitiwari1869 Жыл бұрын
College is the best
@mohdshahbazkhan6206
@mohdshahbazkhan6206 11 ай бұрын
Maza aa gaya
@PrashantGupta-c3m
@PrashantGupta-c3m 4 ай бұрын
Mazaa Aagya Sir 🥰 bas Last wale Ques me Hag diya 😅
@Aakash_Gupta9236
@Aakash_Gupta9236 Ай бұрын
Tamij?
@magicbullet281
@magicbullet281 9 ай бұрын
Stock Span Problem 1:31:00 public static int[] stockSpan(int[] arr){ int[] res= new int[arr.length]; Stack st = new Stack(); res[0]=1; st.push(0); for(int i=1;i
@SonuGupta-ul8ep
@SonuGupta-ul8ep 7 ай бұрын
Thanks bro
@mvenkataadityaprakash9485
@mvenkataadityaprakash9485 8 ай бұрын
Sir at 1:23:15 if worst case (5,4,3,2,1) then we have to travel the whole array again O(n^2) only
@prashantsinha417
@prashantsinha417 Жыл бұрын
Thanks, this is really helpful 🙂🙂
@AAYUSHISAINI-ps3xt
@AAYUSHISAINI-ps3xt Жыл бұрын
perfect.....just perfect!
@skmknowledge472
@skmknowledge472 Жыл бұрын
Finally wait is over
@mathematicswithharsh
@mathematicswithharsh Ай бұрын
45:51 😂😂😂😂😂😂😂😂😂😂
@samiranroyy1700
@samiranroyy1700 10 ай бұрын
thank u sir
@cybernewton8190
@cybernewton8190 Жыл бұрын
Maza aa gaya bhaiya
@Dhruv-v5o4j
@Dhruv-v5o4j Жыл бұрын
Mazaa aa gya 🤩
@PhysicsSwami
@PhysicsSwami 10 ай бұрын
hi sir, for you code on remove Consecutive subsequence which you have given at time stamp around 55-56 minutes in your lecture... if we put the input of array 123332445, then the solution should be 1225, but your code will give output 15.... WHY??... because after you pop 3 because of its repitition, your top of stack is 2 from before. then you are again going to the element 2 that lies after the 3's sequence. And your code compares it will top of stack via peek function and thus removes that 2 also. But according to logic it shouldn't be removed as it is not in a consecutive sequence of 2's... PLEASE THINK OVER IT AND LET ME KNOW. Anyways very nice presentation sir. Thanks.
@patelvideos4347
@patelvideos4347 Жыл бұрын
Sir next greater element code is not working properly..... It drop error a empty stack
@inspirationknowledge728
@inspirationknowledge728 Жыл бұрын
If(st.size>0&&st.peek()
@priyanshgupta4464
@priyanshgupta4464 10 ай бұрын
Wrong Answer Runtime: 0 ms Case 1 Case 2 Input nums = [1,2,1] Output [2,-1,1] Expected [2,-1,2] for nextgreaterelement2
@akashgautam583
@akashgautam583 Жыл бұрын
Very Very Thank You Sir..
@khansirlover3772
@khansirlover3772 Жыл бұрын
Sir please 🙏 continue python lecture series by sudhshnsu sir❤❤
@mbl-md1yr
@mbl-md1yr Жыл бұрын
Hello Sir, I do have a request. Can you start a playlist of "PHP with DSA course" on this channel? It will be helpful for many people.
@vishalv4464
@vishalv4464 11 ай бұрын
what the
@manishrajbhar7026
@manishrajbhar7026 10 ай бұрын
class Solution { public static int[] calculateSpan(int price[], int n) { Stack st = new Stack(); int[] ans = new int[n]; ans[0] = 1; for (int i = 1; i < n; i++) { while (st.size() > 0 && price[st.peek()]
@_hustler_boy
@_hustler_boy 8 ай бұрын
please make video more on dsa
@aryansrivastava6064
@aryansrivastava6064 Жыл бұрын
Are koi c++ ki series bhi complete kra do
@krishnanayak349
@krishnanayak349 24 күн бұрын
Last wala kis kis ko hwa ho gya😂😂😂
@NehaTyagi-s7z
@NehaTyagi-s7z 7 ай бұрын
Q3 sol=>public static boolean isValid(String s) { Stack st = new Stack(); for (int i = 0; i < s.length(); i++) { char ch = s.charAt(i); if (ch == '(' || ch == '[' || ch == '{') { st.push(ch); } else { if (st.isEmpty()) { return false; } else { char top = st.pop(); if ((ch == ')' && top != '(') || (ch == ']' && top != '[') || (ch == '}' && top != '{')) { return false; } } } } return st.isEmpty(); }
@_hustler_boy
@_hustler_boy 8 ай бұрын
dsa placement series aisi hi ek ek topic krwana please
@forbiddenmemes
@forbiddenmemes Жыл бұрын
Trees
@daredevilmax
@daredevilmax Жыл бұрын
Bhaiya plz complete DSA in c language
@pankaj.k_shorts
@pankaj.k_shorts Жыл бұрын
Sir ap kan nextgreater element wala code nahi kam kar rha hai error aa rha hai
@ayushdhiman8329
@ayushdhiman8329 5 ай бұрын
stock span problem n-1 to 0 Loop me kese kare mere se nhi ho raha bus itna hi hua koii help kardo isme Stack st = new Stack(); int[] ans = new int[n]; for(int i=price.length-1; i>=0; i--){ while(st.size()>0 && price[st.peek()]
@A_WAY_TO_BETTER_LIFE
@A_WAY_TO_BETTER_LIFE Жыл бұрын
Sir ,please graduation ke courses bhi laiye , discrete mathematics aur probability jaise subs
@daredevilmax
@daredevilmax Жыл бұрын
Bhaiya plz complete dsa in c
@daredevilmax
@daredevilmax Жыл бұрын
also the dynamic programming
@Sharmaji_ki_ldki
@Sharmaji_ki_ldki Жыл бұрын
bhaiya bhut confuse ho appp....kudh k dount clear krlo then btana ...ek k baad ek pura code hi change krdete ho yr
@lofi7777
@lofi7777 3 ай бұрын
Always respect our teacher IIT kanpur Aap btaye apne college ka name...?
@ARCHITxEDITS
@ARCHITxEDITS Ай бұрын
​@@lofi7777 Dholakpur University
@VedPrakash-zs3wx
@VedPrakash-zs3wx 9 ай бұрын
balance bracket me iska true hoga ya false ) ( ) ( ) (
@vamshi7310
@vamshi7310 7 ай бұрын
False
@priyanshukhandelwal6631
@priyanshukhandelwal6631 Жыл бұрын
awaj dheeme aati h....please try to improve
@deepakkumar13204
@deepakkumar13204 Жыл бұрын
Sir this test case par [{)) apka code wrong aa rha
@sayankuila398
@sayankuila398 Жыл бұрын
Histogram Bala qs bhot hard ha😢
@VinaySharma-pz9tr
@VinaySharma-pz9tr Жыл бұрын
aditya verma se kr le
@anassaif3181
@anassaif3181 Жыл бұрын
Why always directly jumping to solution! ??? Will never tell How to think ? What should be the approach??
@Luffy_2804
@Luffy_2804 Жыл бұрын
arey bhai koi tere ko sochna thodi sikhayega :) yeh sab maths ki problem ki trh hai jese kuch problems ke bad ek pattern follow hota hai wese bina dekhe koi nhi kar skta phle bar mai easy problem ke alawa : ) these problems just help to crack interview nothing more then that
@suryakantabehera4901
@suryakantabehera4901 Жыл бұрын
sir u were saying Google is coming in july month,so its coming to pw or we have to apply ourselves,sir we dont have placement related ideas about these maang companies,so sir plz explain about the procedure to apply for these companies.
@Milan_verma017
@Milan_verma017 9 ай бұрын
bro needs to improve more in codes......totally confused.Not a "Alakh sir's" level
@52nevil36
@52nevil36 Жыл бұрын
Sir please trees krana ab queqe ke baad,aapki wjh se DSA me mja aa rha h
@forbiddenmemes
@forbiddenmemes Жыл бұрын
Yes
@Coding____digital____wallah01
@Coding____digital____wallah01 4 ай бұрын
Kb hoga yrr tree kaha milega tree
@52nevil36
@52nevil36 Жыл бұрын
Finally wait is over
Stacks : Basic, STL and Implementation | Lecture 54 | Java and DSA Course
2:52:01
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 32 МЛН
За кого болели?😂
00:18
МЯТНАЯ ФАНТА
Рет қаралды 3,2 МЛН
Twin Telepathy Challenge!
00:23
Stokes Twins
Рет қаралды 121 МЛН
ТВОИ РОДИТЕЛИ И ЧЕЛОВЕК ПАУК 😂#shorts
00:59
BATEK_OFFICIAL
Рет қаралды 6 МЛН
How To Pass Technical Interviews When You Suck At LeetCode
14:32
How I would learn Leetcode if I could start over
18:03
NeetCodeIO
Рет қаралды 696 М.
Queues - Basic, STL and Implementation | Lecture 57 | Java and DSA Course
2:35:10
FOREVER BUNNY
00:14
Natan por Aí
Рет қаралды 32 МЛН