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
If you have understood the explanation, please do like the video 😊. Like target for this video is 90
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
Thanks 😊
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!
cp wale bhi solution search krte hai
Thank you sir.
❤❤❤
Keep Going 👌👌
Thanks bhaiya 🙏
gjb explain sir
love from china❤
Bhai kal Spain ajj china 😂
bro description is a 2-d array so iterating it should take O(n^2) . isn't it?
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
@@i_do_what_i_like got it thanks bro
we are returning only root then how all others elements are printed ? can you explain please
@@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..
first