Not Able to Understand the Input Pattern of Tree Questions

For Tree Bottom View, Provide the Complete Code(With User Input N Nodes) Please.
I’ve Unlocked Bcoz I’m not able to Create a Tree out of Given Input.
I Mean, Suppose Input is :- 1 2 3 4 -1 -1 -1 and so on, then How to Understand Who is Whose Children.

Prateek Sir Showed an Example Where Input Was Having -1’s in Between but in Few Questions, all -1 's are at the End.

I’m Able to Understand the Question, It’s Just That I’m not able to Build the Tree according to Test Cases, So My Code is not Accepted.

@rtg67GHu_67 it is quite simple. If any value other than -1 is given, make a node of that value, call for its left child, right child and return the root. If the value is -1, return NULL. Let me know if you need any help coding it.

1 Like

I’ll Try Myself First & Let You Know If Needed, Thanks :slight_smile:

1 Like

@rtg67GHu_67 please mark this doubt as resolved if you were able to do it :slight_smile:

1 Like

Done, Check :slight_smile:

1 Like