Binary Tree Level Order Traversal
Use a queue, process nodes in batches equal to the current queue size, and collect their children for the next level.
Return the nodes of a binary tree level by level.
Tagged with queue
Use a queue, process nodes in batches equal to the current queue size, and collect their children for the next level.
Return the nodes of a binary tree level by level.
Wrap a `deque` inside a small class so enqueue uses `append`, dequeue uses `popleft`, and peek reads the leftmost item without removing it.
Implement a queue with enqueue, dequeue, and peek operations.