L13. Preorder Inorder Postorder Traversals in One Traversal | C++ | Java | Stack | Binary Trees

Поделиться
HTML-код
  • Опубликовано: 1 фев 2025

Комментарии • 276

  • @takeUforward
    @takeUforward  3 года назад +141

    Please likeeee, shareeee and subscribeeeeeeee :) Also follow me at Insta: Striver_79

    • @amarjeetkumar-hk2jl
      @amarjeetkumar-hk2jl 2 года назад

      everything is right but writing Pair in" Stack st= new Stack()" giving error in intelliJ IDE.

    • @imshivendra
      @imshivendra 2 года назад +4

      @@amarjeetkumar-hk2jl Where is the link of this problem? Is it not available on Leetcode.

    • @greyhat6599
      @greyhat6599 Год назад +1

      Hattss off to you man !! 😄🎩

    • @dopamaniac_
      @dopamaniac_ Год назад

      i don't know how we can use num for pair in java, because i am getting it as getValue() method, can someone help me about this

  • @prashudeshmukh7902
    @prashudeshmukh7902 Год назад +99

    If someone dosn't watch the tutorial , i don't think he will be able come up with such an approach in the interview .

  • @mansijoshi5643
    @mansijoshi5643 Год назад +103

    This was a great video.
    However it would be more helpful if you could also share the intuition or the idea or the thought process behind developing a solution instead of only explaing it with the dry run of the code. That way we will be able to develop the thinking process to tackle any similar questions in future.

    • @suar_pilla
      @suar_pilla 11 месяцев назад

      idhar udhar se maaal uthae ga to aise hoga

    • @ThePROestRedn99
      @ThePROestRedn99 6 месяцев назад

      ​@@suar_pilla apne name thik rakhe ho akdm😮

    • @ASHUTOSHSHARMA-us6hd
      @ASHUTOSHSHARMA-us6hd 6 месяцев назад +2

      @@suar_pilla 😂😂😂exactly to the point

  • @sarthakragwan5248
    @sarthakragwan5248 2 года назад +48

    To all who thinks why recursion is not used instead of this little complex code i will like to tell the thing that there will be many instances where we need to apply some constraints while using these algorithms to get desire output which may not be got by using recursive method thats why iterative way is important ig.

  • @amarks444
    @amarks444 3 года назад +266

    I found this much easier than other 3 iterative versions.

  • @UtkarshShrivastava6009
    @UtkarshShrivastava6009 2 года назад +89

    We can simply use recursion as well:
    void trav(BinaryTreeNode *root,vector &in, vector &pre, vector &post){
    if(!root) return;
    pre.push_back(root->data);
    trav(root->left, in, pre, post);
    in.push_back(root->data);
    trav(root->right, in, pre, post);
    post.push_back(root->data);
    }

    • @pronoobad6611
      @pronoobad6611 2 года назад +5

      I was thinking about this in whole video ,, so that's why i can't get what video is all about 🥲🥲🥲🥲

    • @vedansh4033
      @vedansh4033 2 года назад

      sahi baat hai, pata nahi itna complicate kyo kiya

    • @himalayagupta7744
      @himalayagupta7744 2 года назад +15

      @@vedansh4033 recursion one we can do ourselves, so I guess that's why he covered iterative one. recursion is literally magic and more intuitive than these iterative solns.

    • @VishalGupta-xw2rp
      @VishalGupta-xw2rp 2 года назад

      Woahhhhh thanx man

    • @VishalGupta-xw2rp
      @VishalGupta-xw2rp 2 года назад +6

      If anyone who doesn't understand the meaning of &..... Here we are updating the original vectors which are passed as arguments while calling the function.
      It's a concept of shared memory (reference) in C++.
      Happy to Help 🙋‍♂️

  • @deepaksarvepalli2344
    @deepaksarvepalli2344 3 года назад +26

    This approach blews my mind....

  • @averylazyandweirdhuman
    @averylazyandweirdhuman 7 месяцев назад +5

    What?? This is cool man! My college could never!!!!!! Striver thanks for putting light on such solutions. You're just awesome!

  • @akhilesh59
    @akhilesh59 3 года назад +18

    This was Amazing. Didn't expected a solution with this level of simplicity :) . Maza aaya!

  • @thomasgeorge4578
    @thomasgeorge4578 3 года назад +23

    What a great approach 👏🏽👏🏽, haven't seen this anywhere

  • @shivangisrivastava1158
    @shivangisrivastava1158 3 года назад +30

    Hats off to the approach, stunningly explained 😍

    • @imshivendra
      @imshivendra 2 года назад

      Where is the link of this problem? Is it not available on Leetcode.

    • @omkarraskar8664
      @omkarraskar8664 2 года назад

      @@imshivendra it is on codestudio

  • @ganeshkamath89
    @ganeshkamath89 2 года назад +26

    I have one suggestion that helped me understand this algorithm better. Change pair from int to string, and set "preOrder", "inOrder", "postOrder" in place of 1,2,3.
    #include
    #include
    #include
    using namespace std;
    struct Node {
    int data;
    struct Node *l, *r;
    Node(int val) {
    data = val;
    l = r = NULL;
    }
    };
    void printTree(vector nodeArray) {
    int n = nodeArray.size();
    for (int i = 0; i < n; i++) {
    cout l != NULL) {
    st.push({ it.first->l, "preOrder" });
    }
    }
    else if (it.second == "inOrder") {
    inOrder.push_back(it.first->data);
    it.second = "postOrder";
    st.push(it);
    if (it.first->r != NULL) {
    st.push({ it.first->r, "preOrder" });
    }
    }
    else {
    postOrder.push_back(it.first->data);
    }
    }
    printTree(preOrder);
    printTree(inOrder);
    printTree(postOrder);
    }
    int main()
    {
    struct Node* root = new Node(1);
    root->l = new Node(2);
    root->r = new Node(3);
    root->l->l = new Node(4);
    root->l->r = new Node(5);
    root->l->r->l = new Node(6);
    root->r->l = new Node(7);
    root->r->r = new Node(8);
    root->r->r->l = new Node(9);
    root->r->r->r = new Node(10);
    preInPostTraversal(root);
    cout

    • @sumitkanth5349
      @sumitkanth5349 2 года назад +2

      What is this auto mean " auto it = st.top(); " ?

    • @kathanvakharia
      @kathanvakharia 2 года назад +4

      ‘auto’ means, the type of this variable will be decided dynamically. In this case, in place of auto one would write “pair it = st.top()” to get the same result.

    • @sumitkanth5349
      @sumitkanth5349 2 года назад

      @@kathanvakharia okii thanks ✌️

  • @theSeniorSDE
    @theSeniorSDE 3 года назад +16

    Striver, this was not much difficult. Understood this properly and took notes as well.

    • @himansh4812
      @himansh4812 Год назад

      @@gautham7244 wtf. 😂

    • @tanishq2766
      @tanishq2766 Год назад

      Sure but, Coming up on your own is ig

  • @MrSaint-ch6xn
    @MrSaint-ch6xn 3 года назад +6

    I never seen an approach like this 🔥🔥🔥

  • @rahular4596
    @rahular4596 Год назад +6

    Recursive is much easier
    void trans(TreeNode* root, vector&inorder, vector&postorder, vector&preorder ){
    if(root == NULL)
    return;
    preorder.push_back(root->val);
    trans(root->left, inorder,postorder,preorder);
    inorder.push_back(root->val);
    trans(root->right, inorder, postorder, preorder);
    postorder.push_back(root->val);
    }

  • @stith_pragya
    @stith_pragya 9 месяцев назад +1

    UNDERSTOOD...Thank You So Much for this wonderful video.....🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @kishorsahoo5446
    @kishorsahoo5446 Год назад

    I love the content ❤.the man behind a successful coder.
    Salute to this man 🙏❤🎉

  • @shauryashekhar
    @shauryashekhar 2 года назад +9

    Just too good you are! Keep making the great content and thanks.

    • @imshivendra
      @imshivendra 2 года назад +2

      Where is the link of this problem? Is it not available on Leetcode.

  • @sweetyagrawal9746
    @sweetyagrawal9746 4 месяца назад

    the return type of the function in the c++ code should be void instead of vector just a little correction

  • @satyamsrivastava9083
    @satyamsrivastava9083 3 года назад +3

    I don't know this approach it is amazing thanks Bro for the amazing video

  • @tanya8353
    @tanya8353 8 месяцев назад +2

    I have watched many of your lectures, but this is the first one where I couldn't understand the intuition behind the code!!

  • @arpitjain6844
    @arpitjain6844 Год назад

    This is a great video, You playlists are really helping us a lot.

  • @cinime
    @cinime 2 года назад +5

    Understood! So wonderful explanation as always, thank you very much!!

    • @imshivendra
      @imshivendra 2 года назад +1

      Where is the link of this problem? Is it not available on Leetcode.

  • @stevefox2318
    @stevefox2318 2 года назад

    This approach blew my whole mind to pieces ❤️‍🔥❤️‍🔥 thanks raj

  • @VAISHNAVIP-z6j
    @VAISHNAVIP-z6j 10 месяцев назад

    It's easier than all other traversals❤️❤️💐💐

  • @nawabkhan4916
    @nawabkhan4916 3 года назад +1

    great work, and have lots of sponsor ad so that you can provide great videos.

  • @sauravchandra10
    @sauravchandra10 Год назад +2

    Maza agya, perfect last video to consolidate all the concepts of traversals.

  • @curs3m4rk
    @curs3m4rk 3 года назад +3

    This is a really nice concept. All in one. thanks

  • @lifehustlers164
    @lifehustlers164 Год назад +2

    Completed 14/54(25% done) !!!

  • @nileshsinha7869
    @nileshsinha7869 3 года назад +1

    please do like the video if u get some value out of it. This is priceless❤

  • @rohitsinha9391
    @rohitsinha9391 3 года назад +1

    It was worth watching bro...Awesome approach

  • @vaalarivan_p
    @vaalarivan_p 2 года назад +1

    1:00 - 3:25
    edoc urhtlklaw: 8:55

  • @ajaykushwaha6137
    @ajaykushwaha6137 3 года назад +13

    Hey, really hats off to you for this approach. I have two questions, this could be very easily done using recursive approach right? And also what is the intuition of this idea? Like How did you land up here or what made you think of an approach this way?

    • @bharathkumar5870
      @bharathkumar5870 3 года назад +27

      for preorder(we print the node when we touch for the first time,before touching left and right node),for inorder we print the node when we touch it for second time(after touching left node),for post order we print the node when we meet it for third time(after meeting left and right)..

    • @bharathkumar5870
      @bharathkumar5870 3 года назад +10

      take a tree with 3 nodes and apply pre,in and post order..see when we are printing the node for each traversal....Intution here is after how many visits we are printing the node.....(assume each node as a root node)

    • @ajaykushwaha6137
      @ajaykushwaha6137 3 года назад +2

      @@bharathkumar5870 You got this from recursive approach right? That is also how I thought, but couldn't have been able to do it iteratively.

    • @PrinceKumar-el7ob
      @PrinceKumar-el7ob 3 года назад

      @@bharathkumar5870 nice intuition loved it !!

    • @himalayagupta7744
      @himalayagupta7744 2 года назад +1

      @@bharathkumar5870 Thank you so much Bharath.

  • @shivanipatwa4709
    @shivanipatwa4709 9 дней назад +1

    woahhh whataa approchhh😧😧😧😳😳😳

  • @meetsoni1938
    @meetsoni1938 2 года назад +1

    Very elegantly done 👍

  • @PalakMittal
    @PalakMittal 3 года назад +9

    Rather than poping out from stack in all the cases, we can rather do, (st.top().second++) in case of number being 1 or 2. And if number is 3 then we can do st.pop()
    Bhaiya Please correct me if I am wrong..

  • @deepakgurjar3746
    @deepakgurjar3746 2 года назад +3

    if anyone is thinking that this is problmatic no its not just view this last one and this video from upar upar and move on...aage ka content tagda haii...yhi pr tree pr mat ruk jana...prsnl experince

  • @anshumanyadav5546
    @anshumanyadav5546 3 года назад +10

    so basically in a pair the left part is termed as first and the second part separated by comma is called second in cpp?

  • @krishnakanttiwari517
    @krishnakanttiwari517 Месяц назад +1

    Thank you so much sir

  • @saikirank6357
    @saikirank6357 Год назад

    Very well explained. Thank you is a small word.

  • @nethanchowdary4657
    @nethanchowdary4657 2 года назад +2

    This video is a gem 💎

  • @JayPatel-sn7it
    @JayPatel-sn7it Год назад +1

    Should we cramming this algorithm or try to understand intuition behind it???

  • @gangsta_coder_12
    @gangsta_coder_12 3 года назад +1

    Great explanation 🔥🔥🔥🔥

  • @BiharCentralSchool
    @BiharCentralSchool 3 года назад +8

    More Simple Code ( Similar to Striver )
    void All_in_one_traversal(node* root)
    {
    if(root==nullptr)
    return;
    stack s;
    vector pre, post,in;
    s.push({root,1}); // Push Root Element with Count = 1
    while(!s.empty())
    {
    auto it = s.top();
    if(it.second==1) // PREORDER
    {
    pre.push_back(it.first->data);
    s.top().second = 2;
    if(it.first->left != nullptr)
    s.push({it.first->left,1});
    }
    else if(it.second==2) // INORDER
    {
    in.push_back(it.first->data);
    s.top().second = 3;
    if(it.first->right != nullptr)
    s.push({it.first->right,1});
    }
    else if(it.second==3) // POSTORDER
    {
    post.push_back(it.first->data);
    s.pop();
    }
    }
    // Printing Pre-Order
    for(int i=0; i

  • @sharmanihal99
    @sharmanihal99 8 месяцев назад

    We can also separate the code for individual traversals:
    PRE ORDER:
    class Solution:
    def preorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
    if not root:return
    stack=[[root,1]]
    preorder=[]
    while stack:
    curr=stack.pop()
    if curr[1]==1:
    preorder.append(curr[0].val)
    curr[1]+=1
    stack.append(curr)
    if curr[0].left:
    stack.append([curr[0].left,1])
    elif curr[1]==2:
    curr[1]+=1
    stack.append(curr)
    if curr[0].right:
    stack.append([curr[0].right,1])
    return preorder
    IN ORDER:
    class Solution:
    def inorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
    if not root:return
    stack=[[root,1]]
    inorder=[]
    while stack:
    curr=stack.pop()
    if curr[1]==1:
    curr[1]+=1
    stack.append(curr)
    if curr[0].left:
    stack.append([curr[0].left,1])
    elif curr[1]==2:
    inorder.append(curr[0].val)
    curr[1]+=1
    stack.append(curr)
    if curr[0].right:
    stack.append([curr[0].right,1])
    return inorder
    POST ORDER:
    class Solution:
    def postorderTraversal(self, root: Optional[TreeNode]) -> List[int]:
    if not root:return
    stack=[[root,1]]
    postorder=[]
    while stack:
    curr=stack.pop()
    if curr[1]==1:
    curr[1]+=1
    stack.append(curr)
    if curr[0].left:
    stack.append([curr[0].left,1])
    elif curr[1]==2:
    curr[1]+=1
    stack.append(curr)
    if curr[0].right:
    stack.append([curr[0].right,1])
    else:
    postorder.append(curr[0].val)
    return postorder

  • @tps8470
    @tps8470 7 месяцев назад

    Loved the solution

  • @Yash-uk8ib
    @Yash-uk8ib 3 года назад +2

    Sir, if possible, plzz make a video on morris traversals as well. Much needed

  • @sunnykumarpal9679
    @sunnykumarpal9679 Год назад

    Thank you bhaiya for making such a fabulous series

  • @rohitranjan8132
    @rohitranjan8132 2 года назад

    Great Explanation 🔥🔥🔥🔥

  • @sigmaschoolmodasa
    @sigmaschoolmodasa 3 года назад +1

    Great Approach and Great Explanation!

  • @prasaddd77
    @prasaddd77 Год назад +6

    What is the name of the leetcode problem for this? Can you provide a link for that ?

  • @Its.all.goodman
    @Its.all.goodman 3 года назад

    very nice explanation bro... much appreciated

  • @iamnottech8918
    @iamnottech8918 7 месяцев назад

    best as always... thnks

  • @pratikshadhole6694
    @pratikshadhole6694 2 года назад +3

    wanted to know if the intuition behind this code is needed to understand or if we need to mug up

    • @083_h_nitishkumarjha3
      @083_h_nitishkumarjha3 2 года назад

      same ? did u got the intution?

    • @mayanksingh5783
      @mayanksingh5783 2 года назад

      just take a tree of 3 node. think if u visit 1st time its pre.then after printing 1as pre u moves to lleft so that left will be printed and u can came back and print 1 as in. after that print 1 as inorder u moves to right.
      So just as u visit 1st time putting it in preorder and telling in second visit 1 is used as inorder.

    • @pratikshadhole6694
      @pratikshadhole6694 2 года назад +1

      @@mayanksingh5783 perfect dude. thanks

  • @prabhakaran5542
    @prabhakaran5542 6 месяцев назад +1

    Understood ❤

  • @ritikshandilya7075
    @ritikshandilya7075 5 месяцев назад

    Thankyou so much striver

  • @rsachdeva1020
    @rsachdeva1020 3 года назад

    Awesome approach and explanation

  • @nainagarg6668
    @nainagarg6668 3 года назад +5

    The links in the description for the problem link and cpp code link are not of this question. Please look into it.

  • @sankalpjain4841
    @sankalpjain4841 3 года назад +1

    Nicely Explained..

  • @tridibeshmisra9426
    @tridibeshmisra9426 Год назад +2

    @take U forward ...what is the intitution behind this ? was it a predefined algorithm or u have to think about such intutuion on the spot!!

    • @takeUforward
      @takeUforward  Год назад +2

      It was pre-defined, pretty tough to come up with such hacks

  • @samuelfrank1369
    @samuelfrank1369 Год назад

    Understood. Thanks a lot.

  • @arpitpandey578
    @arpitpandey578 2 года назад

    This one is better than any other traversal.

  • @Aman-tg5lw
    @Aman-tg5lw 3 года назад +3

    op bhai bhot accha explain kia

  • @zeal1059
    @zeal1059 3 года назад +5

    Striver bhaiya, can we give this approach to interviewer for postorder with 1 stack? Like not push__back in pre and inorder arrays? Please reply.

  • @mriduljain1981
    @mriduljain1981 Год назад

    completed lecture 13 of Tree Playlist.

  • @dikshasoni52a98
    @dikshasoni52a98 8 месяцев назад

    What is better to use....... iterative or recursive method?

  • @nitingoyal5515
    @nitingoyal5515 3 года назад +2

    I watched it, I understood it but I think if I'll try it after some time, I won't be able to do it, so should I cram this?

  • @deveshdubey6776
    @deveshdubey6776 3 года назад

    OP bhaiya🔥🔥 maza aa gaya:)

  • @MrOO-ix5qr
    @MrOO-ix5qr Год назад

    should we learn traversing through iteration and recursion both ?

  • @abhishekgoswami2616
    @abhishekgoswami2616 3 года назад

    mazzaaa hii agya bhaiaa ye dekh kar

  • @kundansai8147
    @kundansai8147 3 года назад +3

    the problem link is taking to level order traversal its not taking to the question which was discussed in the video

    • @takeUforward
      @takeUforward  3 года назад +2

      Let me update

    • @tjstar390
      @tjstar390 2 года назад +2

      @@takeUforward Bhaiya till now it is not updated ,we can't find the problem link.

  • @Learnprogramming-q7f
    @Learnprogramming-q7f 10 месяцев назад

    Thank you Bhaiya

  • @sakshamjain6015
    @sakshamjain6015 2 года назад +2

    What is the intutition behind this approach?

  • @PrinceKumar-el7ob
    @PrinceKumar-el7ob 3 года назад +3

    No need to pop multiples times just pop one time in the postorder condition only !!

  • @pramitsrivastava2579
    @pramitsrivastava2579 2 месяца назад

    thanks sir

  • @dikshasoni52a98
    @dikshasoni52a98 8 месяцев назад

    in the website.. the question link linked is of postorder traversal and not this question

  • @shineinusa
    @shineinusa 3 года назад +3

    No need to pop and push again in cases 1 and 2 :
    From where did you get this algorithm? Any ways thank you!!
    public List preOrder(TreeNode root, List op) {
    if(root == null) return op;
    Stack stack = new Stack();
    Pair start = new Pair(root, 1);
    stack.push(start);
    while(!stack.isEmpty()) {
    Pair p = stack.peek();
    if(p.order == 1) {
    op.add(p.node.val);
    if(p.node.left != null) {
    Pair p1 = new Pair(p.node.left, 1);
    stack.push(p1);
    }
    p.order = 2;
    }
    else if(p.order == 2) {
    if(p.node.right != null) {
    Pair p1 = new Pair(p.node.right, 1);
    stack.push(p1);
    }
    p.order = 3;
    }
    else if(p.order == 3) {
    stack.pop();
    }
    }
    return op;
    }

  • @miss_anonymous16
    @miss_anonymous16 3 года назад

    Amazing ❤️🔥

  • @mohit7717
    @mohit7717 8 месяцев назад

    THank you so much!

  • @vimalvinayak001
    @vimalvinayak001 Год назад +2

    Till now, the question link has not been updated. Can anyone provide the question link of any website?

  • @yatendraupadhyay2180
    @yatendraupadhyay2180 Месяц назад

    Bhaiya kindly add the intuition as well.
    I mean how can anybody come up with such a solution on their own in the interview.

  • @ankitmeena6842
    @ankitmeena6842 2 года назад

    # For Python peeps
    class BinaryTreeNode :
    def __init__(self, data) :
    self.data = data
    self.left = None
    self.right = None
    def getTreeTraversal(root):
    if not root:
    return []
    pre_order,in_order,post_order=[],[],[]
    stack=[[root,1]] # adding [node,index] to stack
    while stack:
    working_item=stack[-1]
    if working_item[1]==1:
    pre_order.append(working_item[0].data)
    stack[-1][1]+=1

    if working_item[0].left:
    stack.append([working_item[0].left,1])
    elif working_item[1]==2:
    in_order.append(working_item[0].data)
    stack[-1][1]+=1

    if working_item[0].right:
    stack.append([working_item[0].right,1])
    else:
    post_order.append(working_item[0].data)
    del stack[-1]
    return [in_order,pre_order,post_order]




    # # another approach , tle score: 34.8/40
    # if not root:
    # return [[],[],[]]
    # l=getTreeTraversal(root.left)
    # r=getTreeTraversal(root.right)
    # return [l[0]+[root.data]+r[0],[root.data]+l[1]+r[1],l[2]+r[2]+[root.data]]

  • @Virtualexist
    @Virtualexist Год назад +3

    How can someone come up with this intuition? I could relate it to the arrow method, but any help or any suggestions how to develop this without any video??

  • @umeshkaushik710
    @umeshkaushik710 2 года назад

    Great Work

  • @ashutoshtewari274
    @ashutoshtewari274 2 года назад +2

    Why cant we do this using recursion?
    Like This:
    void traversal(BinaryTreeNode *root, vector &pre, vector &in, vector &post)
    {
    if(root==NULL)
    {
    return ;
    }
    pre.push_back(root->data);
    traversal(root->left, pre, in, post);
    in.push_back(root->data);
    traversal(root->right, pre, in, post);
    post.push_back(root->data);
    }
    vector getTreeTraversal(BinaryTreeNode *root)
    {
    vector ans;
    vector pre;
    vector in;
    vector post;
    traversal(root, pre, in, post);
    ans.push_back(in);
    ans.push_back(pre);
    ans.push_back(post);
    return ans;
    }

  • @jainilpanchal2000
    @jainilpanchal2000 3 года назад

    Mind-boggling 🧐

  • @nagavedareddy5891
    @nagavedareddy5891 3 года назад

    Huge respect...❤👏

  • @hakunamatata-nl4js
    @hakunamatata-nl4js 8 месяцев назад

    Thanks

  • @pratyakshhhhhhhhhhhhhhhhhhhhh
    @pratyakshhhhhhhhhhhhhhhhhhhhh Год назад

    Wowww❤

  • @technicaldoubts5227
    @technicaldoubts5227 Год назад

    totally understood thankyouuu so much !!

  • @Ajay-ei2jo
    @Ajay-ei2jo 2 года назад

    Thank you sir.

  • @vakhariyajay2224
    @vakhariyajay2224 Год назад

    Thank you very much.

  • @DeadPoolx1712
    @DeadPoolx1712 3 месяца назад

    UNDERSTOOD;

  • @SaurabhAgastya
    @SaurabhAgastya Месяц назад

    UNDERSTOOD

  • @utsavseth6573
    @utsavseth6573 Год назад

    FInally, something I can remember.

  • @anantsaxena5454
    @anantsaxena5454 7 месяцев назад

    🙏🙏🙏🙏

  • @JohnWick-kh7ow
    @JohnWick-kh7ow 3 года назад +1

    I didn't find any practice problem. Is it asked in interviews?

    • @takeUforward
      @takeUforward  3 года назад

      Code studio link

    • @JohnWick-kh7ow
      @JohnWick-kh7ow 3 года назад +3

      @@takeUforward But that is level order traversal question.

  • @arihantjainajbil8182
    @arihantjainajbil8182 Год назад

    bahut pyaara

  • @bhavkushwaha
    @bhavkushwaha 9 месяцев назад

    Took time to solve, but did. Thankyou Striver!

  • @AyushGupta-kp9xf
    @AyushGupta-kp9xf 3 года назад

    awesome approach!