Find sum at level k(trees)

here’s the link to my code https://ide.codingblocks.com/s/234100 it’s not giving the right output

Hello @pooja_narula,

Your build function is not correct.
It is creating wrong tree.
Suggestion:
You can print the tree level order wise to see that.

Corrected code:

Hope, this would help.
Give a like if you are satisfied.