2196. Create Binary Tree From Descriptions | Trees | Leetcode Daily Challenge | DSA | Hindi

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024
  • Problem Name:
    2196. Create Binary Tree From Descriptions
    Problem Statement:
    You are given a 2D integer array descriptions where descriptions[i] = [parenti, childi, isLefti] indicates that parenti is the parent of childi in a binary tree of unique values. Furthermore,
    If isLefti == 1, then childi is the left child of parenti.
    If isLefti == 0, then childi is the right child of parenti.
    Construct the binary tree described by descriptions and return its root.
    The test cases will be generated such that the binary tree is valid.
    Problem Link:
    leetcode.com/p...
    Graph Playlist:
    • Graph Data Structure S...
    Java Plus DSA Placement Course Playlist:
    • Java and DSA Course Pl...
    Java Plus DSA Sheet:
    docs.google.co...
    Notes:
    github.com/Tiw...
    Telegram Link:
    shashwattiwari...
    Ultimate Recursion Series Playlist:
    • Recursion and Backtrac...
    Instagram Handle: (@shashwat_tiwari_st)
    shashwattiwari...
    Samsung Interview Experience:
    • I cracked Samsung | SR...
    Company Tags:
    Facebook | Amazon | Microsoft | Netflix | Google | LinkedIn | Pega Systems | VMware | Adobe | Samsung
    Timestamp:
    0:00 - Introduction
    #ShashwatTiwari #coding​​ #problemsolving​

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

  • @shashwat_tiwari_st
    @shashwat_tiwari_st  Месяц назад +6

    If you have understood the explanation, please do like the video 😊. Like target for this video is 90

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

      Kya aap ek video main yeh bata sakte ho ki how younthink of a solution and how much actual time you take it would be helpfull

  • @RohitKumar-dz8dh
    @RohitKumar-dz8dh Месяц назад +2

    Thanks 😊

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

    OMG this sol is great.Its so compact.Thank you so much.Also thankyou for doing it in java.Everyone does it in C++ and myself being only one doing DSA/CP in java...I struggle to find sol on youtube.Thank you so much!

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

      cp wale bhi solution search krte hai

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

    Thank you sir.

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

    ❤❤❤

  • @user-jq7gn6iv3e
    @user-jq7gn6iv3e Месяц назад +1

    Keep Going 👌👌

  • @AmanSharma-fp5wk
    @AmanSharma-fp5wk Месяц назад +1

    Thanks bhaiya 🙏

  • @user-oi5ls4rs5g
    @user-oi5ls4rs5g Месяц назад +1

    gjb explain sir

  • @GirjeshSharma-zv3xo
    @GirjeshSharma-zv3xo Месяц назад +1

    love from china❤

  • @Pinncle-l2m
    @Pinncle-l2m Месяц назад +2

    bro description is a 2-d array so iterating it should take O(n^2) . isn't it?

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

      Each element among n elements has 3 elements. So total traversal complexity is O(3*n) = O(n). It would have been n^2 if each element had n elements

    • @Pinncle-l2m
      @Pinncle-l2m Месяц назад

      @@i_do_what_i_like got it thanks bro

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

    we are returning only root then how all others elements are printed ? can you explain please

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

      @@Smarty_329 If you read the problem description, it is given that we only have to return the root of the new tree formed.
      They will traverse and check if it is correct or not (level order traversal).
      If you want to check, you can apply level order traversal and verify with outputs given in sample test cases..

  • @PiyushSharma-we8yd
    @PiyushSharma-we8yd Месяц назад

    first