Online Assessment Question.Need help to solve this.
223

Binary tree nodes are given in the form of an array where left child for arr[i] will be at arr[2i]
and right child will be at arr[2
i+1].
Array indexing starts from 1 .Count all the number of leaf nodes.
-1 indicates node is null.
arr[] = [2,1,3,-1,5,7,-1];
No of leaf nodes will be 2 in this case.
Can anyone help me to solve this, I was not able to find a proper solution for this question.

Comments (1)