Kth Zero in an array

here is the ss for the explanation for finding the kth zero in an array using segment tree… can anyone help me to understand why they have subtracted the left child value from the right child ?

If you are talking about the last line it’s because the left child already contains t[v2] 0’s. So, we only need to search for k-t[v2] zeroes in the right child.

1 Like

oh ok bro got that now !! thanks for the help :slightly_smiling_face: