Hey Oussama, thanks for this — it was exactly what I googled for lol…question though.
In your implementation, I see you adding the null sentinel for the root node, but I can’t figure out where the other levels would have had these inserted. Respectfully, I’d mention that since that’s the meat of your post, it would be great to see a snippet for that too I think. My guess is when we do queue.append(node.right) we should also then be doing queue.append(None) no?
Thank you again for the post on this interesting problem set sir!