Honestly, the best explanation to this problem that i could found on the internet! More power to you!! :)
@vivianzhao15138 жыл бұрын
Your explanation is pretty intuitive cause I kind of get lost when going through the code in geeksforgeesk
@ByteByByte8 жыл бұрын
I'm glad it was helpful!
@tanayasharma77762 жыл бұрын
glad i looked up for this , i could not understand this even after reading articles and watching some other explanations, the way you explained it with examples helped a lot .
@chandandwivedi23624 жыл бұрын
I am your Huge fan. What I like most about you and your channel is that this is the place where I not only get the Solution of the problem but also idea about how to think and approach the problem. Thanks a Lot!! Keep the good work.
@Aditrash-n5j Жыл бұрын
Brilliant Explanation !!! (Btw, which IDE you are using )
@sathanand6 жыл бұрын
Summary: k + 1 linkedlists (or stacks) k linkedlists' head elements are in the top[] array. 1 - linkedlist of free elements. "free' holds the head of this list. next[] array has next pointers for each element in the above lists. push --> pop from the 'free' list and make it head of one of k lists. pop --> pop from the given list (one of the k) and make it head of 'free' list.
@ramubavireddi3 жыл бұрын
Thanks Anand. I think it is the simplest and straightforward summary/ steps of the solution.
@mandar.vaidya4 жыл бұрын
This is the best , I did look at many places but glab found you . My best wishes with you .
@9awan3 жыл бұрын
This is a very informative video, Sam.
@PMPhotographyVideography7 жыл бұрын
Good job man....you explained an "unreasonable" problem so well
@ByteByByte7 жыл бұрын
haha thanks! it is a hell of a problem for sure
@ayushmishra33884 жыл бұрын
This problem should be titled as "STACKS ABSURDITY!".
@itzeltravels8 жыл бұрын
Thank you so much for explaining these questions so well, I've been looking for videos that explain interview questions, and your explanations are the most understandable by far. Thanks again for doing this, it really helps!
@ByteByByte8 жыл бұрын
You're very welcome! Thanks for the kind words :)
@cschandragiri6 жыл бұрын
My brain started popping out, why would someone ask this question in an interview! You won't get it unless you have seen this solution before.
@ByteByByte6 жыл бұрын
That's definitely not true
@JaiSinghKav6 жыл бұрын
@ 14:52 shouldn't the stack data be 7 instead of 2?
@徐瑞斌-i8o5 жыл бұрын
It's easier to explain by just saying "using N+1 linked lists, for N stacks and one free list, all in linked list form. In detail we implement the link by an index array rather than a pointer. Finally, those N+1 linked list can reuse a same "link" array, though they should keep their own head. And use index -1 to stand for a null-pointer. The free list can in fact implemented as a stack, thus we have N+1 stacks."
@tanzeelrana73484 жыл бұрын
why can't we use double linked lists ?
@karishmajain69804 жыл бұрын
if the nextAvailable is -1 that means that the array is full. In that case do we double the size of the array or we do something else?
@robsylvester2726 жыл бұрын
This is hot codin' dude. Well done.
@ByteByByte6 жыл бұрын
Haha thanks!
@aditisharma69807 жыл бұрын
Very appropriate explaination. Thank you!
@sumeshpandit93594 жыл бұрын
finally, got the trick of pushing and popping.
@udaysaiphanindra31386 жыл бұрын
thank you for clear explanation sir.
@ByteByByte6 жыл бұрын
you're welcome!
@yooos37 жыл бұрын
Brilliant video and excellent logic! Thanks a lot!
@ByteByByte7 жыл бұрын
Thank you!
@LegitGamer23454 жыл бұрын
idk if you will see this but , if you can make a video on implementing n queue in an array , it would be really helpful , the code is very similar to this but I end up getting lost in it , if you make a video on it , I'm sure I would gain more insight on it.
@sameeragrawal927 жыл бұрын
That was best explanation, the problem is quite tricky. You helped me understand it (Y)
@ByteByByte7 жыл бұрын
Thank you! Glad the video helped :)
@anwarsiddiqui82107 жыл бұрын
At 25:07 do we explicitly need to throw the IndexOutOfBoundsException, coz operation at 27:52 could also throw the same exception...
@ByteByByte7 жыл бұрын
You're right. I think it is better code this way, though, because it's much more clear when there is going to be an exception
@anwarsiddiqui82107 жыл бұрын
I see, by the way very lucid explanation... #wayToGo
@siteshp6 жыл бұрын
Thanks for explaning it so well. I loved every bit of it and sort of it had become intuitive in the middle. Keep up the good work
@ByteByByte6 жыл бұрын
You're welceom!
@vasan658 жыл бұрын
Loved your way of explanation, I heard your push explanation and was able to figure out pop. Thank you so much.
@ByteByByte8 жыл бұрын
Srinivas Jagadeesh so glad I could help!
@codeAsCoder3 жыл бұрын
Thank you sir 😀
@pawansaini46245 жыл бұрын
Thanks sir, nice explanation
@vivekshaw24375 жыл бұрын
Thanks a lot. Brilliant Video.
@vishvaasvardaan6 жыл бұрын
Hi thanks! Really good explanation. But is this efficient?
@ByteByByte6 жыл бұрын
In what way?
@ashishchaturvedi37106 жыл бұрын
Great Work
@ByteByByte6 жыл бұрын
thanks!
@harshmodi56667 жыл бұрын
Amazing explanation. Very Simple, clear and effective. Thank you so much :)
@ByteByByte7 жыл бұрын
Thanks!
@edwardhouser53186 жыл бұрын
what a about creating three stacks with one array? Reply
@ambika11076 жыл бұрын
I am a QA from bay area looking for job. This question seem to be too much for .a QA and why would someone ask this. Its very confusing for me. I am looking at the video again and again by rewinding to understand better
@ByteByByte6 жыл бұрын
What makes you think they would ask this of a QA? I don't know too much about QA interviews, but this is definitely reasonable for an SE
@edwardhouser53186 жыл бұрын
what a about creating three stack with one array?
@ByteByByte6 жыл бұрын
You could do that, but you're limited to 3 stacks
@rahulbhati30794 жыл бұрын
Thanks sir
@RaviTejaVanjarapu7 жыл бұрын
Awesome explaination !!
@ByteByByte7 жыл бұрын
Thank you :)
@BardzoZueDziecko3 жыл бұрын
How it's n stacks with a single array if you're using 3 arrays to implement it xD
@JEDIWJR7 жыл бұрын
Like your video. That helps a lot man.
@ByteByByte7 жыл бұрын
thanks!
@aprofromuk8 жыл бұрын
maybe it wud have been easier to understand if u named the nextIndex[] array to prevNextIndex[] array illustrating its use case clearly through the name :)
@ByteByByte8 жыл бұрын
yeah that might help. prevNext* sounds totally contradictory though :P
@sankethb.k6425 жыл бұрын
Amazing!!!
@rohitashwanigam5 жыл бұрын
Beautiful
@BrianFaure17 жыл бұрын
Why would someone dislike this video? wtf
@ByteByByte7 жыл бұрын
@wildglorypsn8 жыл бұрын
such a difficult and complex problem :/
@ByteByByte8 жыл бұрын
I wouldn't necessarily expect this in an interview, but it's still good to push yourself :)
@siddharthsharma36796 жыл бұрын
@wildglorypsn, just make sure you dont pop your brains out.
@cooldudeyanarp7 жыл бұрын
instead of typing the entire code u could have explained the solution on paper :(
@ByteByByte7 жыл бұрын
I could, but I don't think it would be very easy to read. Would love a tablet to write on, though
@jss6720066 жыл бұрын
You took 41 minutes to explain this and too much code if (top1 < top2 - 1) { top1++; arr[top1] = x; } OR top2--; arr[top2] = x; AND if (top1 >= 0 ) { int x = arr[top1]; top1--; return x;
@ByteByByte6 жыл бұрын
I mean you would have failed your interview for not listening to the problem, but okay