Click here to see the full article post
for second method, if the input is a nullptr then it will have runtime error.
@xwEm [null] input is invalid and  will never be the input as binary tree is non-empty.
oh okay. I got what you mean. It was in the description.
Why do you need two queues? One queue could do the work.
How does count and res get updated in case 1? Since we donot return any value?
Very handy trick for level-wise traversal with level tracking.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.