thanks... 1 - we can use set right instead of map? 2 - space kyun add kara.... bina space ke bhi toh same hi chalna chayie ? note --- one suggestion, please use colors, as sometimes it gets messy..
Yes we can use set but i mostly prefer map 😅. Space i have added just to be in safer side i have said in the video as well that it can work without space as well Thanks for the suggestions
@@code_kar_lo i tried HashSet, but facing issue in duplicates... i tried to check if answer is present already then don't add but since and stores node and thus address isn't same and contains logic not working on the ans , i use Java
Preorder means first you will add node then left then right and you can see while making the string first i am adding node data then going on left then right
nice approach to tackle the problem of same preorder of different subtrees. Thanks for providing the solution!
Thanks 🙏❤️
sir your videos are amazing. Your teaching style is very good.
Sir can you please launch a series on trees?
Thanks a lot. Yes i will make a series in some days. Currently pattern series is going on you can watch that as well
thanks...
1 - we can use set right instead of map?
2 - space kyun add kara.... bina space ke bhi toh same hi chalna chayie ?
note --- one suggestion, please use colors, as sometimes it gets messy..
Yes we can use set but i mostly prefer map 😅.
Space i have added just to be in safer side i have said in the video as well that it can work without space as well
Thanks for the suggestions
@@code_kar_lo i tried HashSet, but facing issue in duplicates... i tried to check if answer is present already then don't add but since and stores node and thus address isn't same and contains logic not working on the ans , i use Java
Yes if you are using set you the code will complex and you have to do multiple handilations
bro there is similar q on leetcode try to solve then yo will know why space required
you said its preordere, and then moved on to extreme left.
Preorder means first you will add node then left then right and you can see while making the string first i am adding node data then going on left then right
surkiya