I am not getting any output

I have done some editing but the approach you are using in your zigzag function is not right, as in your while loop you have to check if s1 and s2 until your s1 & s2 is not empty so you have to add root in s2 too

Submit this code, it’s giving 100% result. It’s your code only have just removed s2 condition and it get’s accepted.

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.