Flatten Nested List Iterator | 3 Approaches | Full Details | GOOGLE | NETFLIX | Leetcode - 341

  Рет қаралды 4,342

codestorywithMIK

codestorywithMIK

Күн бұрын

This is the 12th Video on our Design Data Structure Playlist.
In this video we will try to solve a very good Design Problem - Flatten Nested List Iterator (Leetcode-341).
Share your learnings on LinkedIn, Twitter (X), Instagram, Facebook(Meta) with #codestorywithmik & feel free to tag me.
I will explain the intuition so easily that you will never forget and start seeing this as cakewalk EASYYY. We will do live coding after explanation and see if we are able to pass all the test cases.
Problem Name : Flatten Nested List Iterator
Company Tags : META | GOOGLE | NETFLIX | TWITTER
My solutions on Github : github.com/MAZ...
Leetcode Link : leetcode.com/p...
My DP Concepts Playlist : • Roadmap for DP | How t...
My Graph Concepts Playlist : • Graph Concepts & Qns -...
My GitHub Repo for interview preparation : github.com/MAZ...
Subscribe to my channel : / @codestorywithmik
Instagram : / codestorywithmik
Facebook : / 100090524295846
Twitter : / cswithmik
╔═╦╗╔╦╗╔═╦═╦╦╦╦╗╔═╗
║╚╣║║║╚╣╚╣╔╣╔╣║╚╣═╣
╠╗║╚╝║║╠╗║╚╣║║║║║═╣
╚═╩══╩═╩═╩═╩╝╚╩═╩═╝
#coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge #leetcodequestions #leetcodechallenge #hindi #india #coding #helpajobseeker #easyrecipes #leetcode #leetcodequestionandanswers #leetcodesolution #leetcodedailychallenge#leetcodequestions #leetcodechallenge #hindi #india #hindiexplanation #hindiexplained #easyexplaination #interview#interviewtips #interviewpreparation #interview_ds_algo #hinglish #github #design #data #google #video #instagram #facebook

Пікірлер: 62
@FanIQQuiz
@FanIQQuiz Жыл бұрын
This is the lengthiest and most informed explanation of this problem on KZbin. I checked other videos as well but this one is a gem
@iWontFakeIt
@iWontFakeIt Жыл бұрын
what an explanation man!!! loved it, too good man, same as always watching you for the past 6months
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Means a lot 🙏😇
@wearevacationuncoverers
@wearevacationuncoverers Жыл бұрын
You are the only guy, whose long videos I watch with full interest.
@pritamkumarpattanayak1497
@pritamkumarpattanayak1497 6 ай бұрын
this is the question i was asked for a company havign 4.5 lpa. So everyone watching this comment increase your level. this it platforms copetition is too much hard now a days.
@HealthyOm
@HealthyOm Жыл бұрын
love u bhaiay keep doing world greatest work for DSA fearful students .... .. and make much more concept related vedios .... we love ur qns apporaching type everyone want learn it ... plase love love love love love love u bhaiaya😘😘
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Means a lot. Thank you 🙏😇❤️
@wearevacationuncoverers
@wearevacationuncoverers Жыл бұрын
Coded on my own after the explanation ended 15:14 Thanks for the detailed explanation.
@satyamkushwaha6217
@satyamkushwaha6217 8 ай бұрын
Unbelievable explanation sir.❤❤
@akashkumarmaurya2319
@akashkumarmaurya2319 Жыл бұрын
No doubt solution is super easily explained . and i am learning alot not only concept but also how to explain like u ..all is set but there is some lag between yr voise and text of i think 1 second . if u do so it will be great .. it is only a feedback , but for me its all okay..
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Thank you so much. Let me try to fix the lag. Thanks a lot for your feedback 🙏😇
@Piyushraj0
@Piyushraj0 Жыл бұрын
Nicely explained once again❤ I was asked a similar question 5months back for an intern role in javascript. I couldn't solve it that time. I solved this leetcode one in one go as a revenge 😅😂😭.
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Wow. That’s what i call a comeback 🔥🔥🔥 Let’s keep working hard anf growing like this 💪💪💪
@UECAshutoshKumar
@UECAshutoshKumar 7 ай бұрын
Thank you!
@nagmakhan3165
@nagmakhan3165 Жыл бұрын
Thanks for covering minute details. Gonna learn a lot from you
@thefinalfit
@thefinalfit Жыл бұрын
Most detailed and best explanation. Thanks a lot
@nealsutaria2633
@nealsutaria2633 3 ай бұрын
Amazing!
@souravjoshi2293
@souravjoshi2293 Жыл бұрын
dope explanation of all the approaches.
@de_coder1
@de_coder1 Жыл бұрын
Your explanations are damn good❤❤
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Means a lot 😇🙏
@JoyAcharyatvl
@JoyAcharyatvl Жыл бұрын
awesome boss. Thanks
@codestorywithMIK
@codestorywithMIK Жыл бұрын
You're welcome! 😇🙏
@trailsnail
@trailsnail Жыл бұрын
good, better, best. Can the approach 3 be said to be having a amortized constant time as the flattening is being done in the constructor itself
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Definitely 👌👌👌
@tutuimam3381
@tutuimam3381 Жыл бұрын
Thanks a lot
@newglobal7271
@newglobal7271 Жыл бұрын
Bhaiya ajj bhi maja agya🙏🙏❤❤❤❤❤❤
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Means a lot. Thank you so much 🙏😇
@ss8273
@ss8273 Жыл бұрын
maza aagya bhaiya 👌👌👌👌
@codestorywithMIK
@codestorywithMIK Жыл бұрын
🙏😇
@kunal4710
@kunal4710 Жыл бұрын
This would give best time and space complexity Approach 3 - //Store address instead of object to reduce space queue q; void openList(vector &nestedList){ int n= nestedList.size(); for(int i=0;igetInteger(); q.pop(); return el; } bool hasNext() { return !q.empty(); }
@DevOpskagyaan
@DevOpskagyaan Жыл бұрын
You are just awesome ❤
@23cash86
@23cash86 Жыл бұрын
Thanks alot
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Most welcome 😇
@musaddikkhan9720
@musaddikkhan9720 Жыл бұрын
Bro I just feel fear for this type of question and oops and ptr se kya dushmani hai pata hi nahi kitne bhi videos dekh lo bheje me ghus jate hai aur phir wapas nikal jaate hai.... aur abhi jo tmne kaha woh bhi ab pata chala pr khud karunga na to bilkul nahi samjega ki woh const pr & kyun lia waise thanks for video
@codestorywithMIK
@codestorywithMIK Жыл бұрын
I can understand. Actually there are lots of minute details in OOPs which I also always forget. I will try to make a playlist for OOPs too. For now, let me give a small brief which will help why I used & : If you simply write , vector vec = curr->getList(); This attempts to assign the result of curr->getList() to a vector named vec. The issue here is that getList() returns a const vector &, which means it returns a constant reference to a vector of NestedInteger objects. You cannot directly assign a constant reference to a non-constant object like vector vec. If you want to store the result of getList() in a new vector, you should make sure the new vector is also a constant reference or a constant object. So, we wrote &. You can also write as follows : const vector& vec = curr->getList(); Or, vector& vec = curr->getList();
@musaddikkhan9720
@musaddikkhan9720 Жыл бұрын
Thank You So much mazhar bhai really helpful... maine ye notebook me likh lia aur const keyword bhi padh lia... const keyword like a promise in real world we cannot change it..etc etc uske niche ye bhi likh lia 😊🫂
@xiaoshen194
@xiaoshen194 Жыл бұрын
Bhai maine exact ye ques JS seekhte waqt kia tha. Do check it out :
@xiaoshen194
@xiaoshen194 Жыл бұрын
30 days of JavaScript (study plan) -> flatten a deeply nested array.
@xiaoshen194
@xiaoshen194 Жыл бұрын
kzbin.info/www/bejne/lXXIpX-GgNl5hM0si=XqxgUOXhOAt-AJaV Aur ye uska solution.
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Hey wow. That’s awesome. Thank you for sharing 🙌❤️
@harikrushnasuhagiya3925
@harikrushnasuhagiya3925 Жыл бұрын
Thank you so much brother
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Always welcome 🙏😇
@TheProblemSolvers38
@TheProblemSolvers38 Жыл бұрын
Is there a lag between the audio and video or Is the problem on my end ?
@codestorywithMIK
@codestorywithMIK Жыл бұрын
It seems to be in sync at my end. Can you confirm if you are facing this for this video or any other video also ??
@harshtiwari416
@harshtiwari416 Жыл бұрын
Bhai const pr & kyu liya tha please oops ka concept clear hai fir bhi samajh nhi aarha thodi direction dedoo btw Nice work keepitup
@codestorywithMIK
@codestorywithMIK Жыл бұрын
If you simply write , vector vec = curr->getList(); This attempts to assign the result of curr->getList() to a vector named vec. The issue here is that getList() returns a const vector &, which means it returns a constant reference to a vector of NestedInteger objects. You cannot directly assign a constant reference to a non-constant object like vector vec. If you want to store the result of getList() in a new vector, you should make sure the new vector is also a constant reference or a constant object. So, we wrote &. You can also write as follows : const vector& vec = curr->getList(); Or, vector& vec = curr->getList();
@harshtiwari416
@harshtiwari416 Жыл бұрын
@@codestorywithMIK ty bhaiya
@RajSingh-te1uo
@RajSingh-te1uo Жыл бұрын
At 41:25 why & is used with NestedIntger to create obj ...I'm not good at OOP.. anyone please?
@codestorywithMIK
@codestorywithMIK Жыл бұрын
If you simply write , vector vec = curr->getList(); This attempts to assign the result of curr->getList() to a vector named vec. The issue here is that getList() returns a const vector &, which means it returns a constant reference to a vector of NestedInteger objects. You cannot directly assign a constant reference to a non-constant object like vector vec. If you want to store the result of getList() in a new vector, you should make sure the new vector is also a constant reference or a constant object. So, we wrote &. You can also write as follows : const vector& vec = curr->getList(); Or, vector& vec = curr->getList();
@RajSingh-te1uo
@RajSingh-te1uo Жыл бұрын
@@codestorywithMIK Thank you sir for writing this long explanation ♥️... Really thank you!
@parthbhatti4151
@parthbhatti4151 Жыл бұрын
i know basic of all dsa so how can i use your channel to reach at good level on DSA because your channel have lot's of playlist so how should i start with your channel to i will have maximum utilize ?
@kamranwarsi12b22
@kamranwarsi12b22 Жыл бұрын
How to approach these design based questions, usually i get confused like what should be the way of thinking ?
@codestorywithMIK
@codestorywithMIK Жыл бұрын
I have tried to explain in the starting of the video like how to approach in flattening qns. Generally design based Qns want you to crack that which DS you will use that will solve the problem most efficiently. Usually I try with the simplest Data Structure and solve. Once done, i see which functions are slow and how we can improve it.
@kamranwarsi12b22
@kamranwarsi12b22 Жыл бұрын
@@codestorywithMIK oh ok ok...
@user-kaushikeemishra
@user-kaushikeemishra Жыл бұрын
bhaiyaa please java me bhi code likhkr samjha kr diyaa krooo.... mai java me code krti hu aur begginer hu..to muje sbka meaning nhi samj aata hai... plese bhaiayyyaa
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Actually I provide similar java code in my Github link. Will that help ? Actually explaining the Java code might extend the video length sometimes
@user-kaushikeemishra
@user-kaushikeemishra Жыл бұрын
@@codestorywithMIK bhai aap bs hard problems me Java me code ko thoda sa explain kr dijiyega...kyuki usme kafi high level ki chize aa jati ho samj nhi aati hai...agr esa possible ho to kr dijiyega baki aap bahut achha explain krte hai..Mai hard problems ko bhi samjne ki kosis kraugi.......
@YashJain-ex2ex
@YashJain-ex2ex Жыл бұрын
Hii, pelase solve Odd Even and Racecar leetcode problem not able to found any proper source to understand it Leetcode - 818 Leetcode - 975
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Sure noted.
@devkumar9889
@devkumar9889 Жыл бұрын
Kaha se easy q hai ye 🥲, itne hints ke baad bhi nai hua tha mere se
@codestorywithMIK
@codestorywithMIK Жыл бұрын
Actually the naive approach - storing all integers in an array or a queue comes in a handy solution. However using stack will need some practice to get hands with. I am sure with more practice we will be able to solve such qns with ease. Let’s keep moving 🙏😇💪💪
Seat Reservation Manager | 3 Ways | Intuition | META | Leetcode - 1845
24:05
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН
Правильный подход к детям
00:18
Beatrise
Рет қаралды 11 МЛН
Try this prank with your friends 😂 @karina-kola
00:18
Andrey Grechka
Рет қаралды 9 МЛН
Flatten Nested List Iterator - Leetcode 341 - Python
10:14
NeetCodeIO
Рет қаралды 11 М.
5 Secrets to Stop Stuttering & Speak More Clearly!
12:44
Vinh Giang
Рет қаралды 145 М.
I Spent 100 Hours Inside The Pyramids!
21:43
MrBeast
Рет қаралды 23 МЛН
Sigma Kid Mistake #funny #sigma
00:17
CRAZY GREAPA
Рет қаралды 30 МЛН