LEETCODE -> 662


this is my code
please tell why it not work and also time complexity of my current code (i think o(n) ) . and please solve it by level order and if another method then give me a hint

Your code is quite messed up and difficult to understand


This is my code for the same question. I solved it using level order traversal only. Please tell me if you are able to understand this.

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.