How to take input in this problem

for the mentioned tree, inputs are like - [1, 3, 4, null, 2]

But how will I know that the node 2 and 4 are leaf nodes.

input for the mentioned case should be like - [1, 3, 4, null, 2, null, null, null, null]

Please help me with this.

Hi @LPLC0111
u have to assume those null which u are talking about

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.