sir I am not getting the sum at each level can you please help
Error in the output
else if (!q.empty()) {
q.push(NULL);
level++;
}
this is wrong you have to do this condition only if temp is NULL
outside if condition
check the modified Code
Modified Code