-
Notifications
You must be signed in to change notification settings - Fork 303
Open
@tech-cow
Description
116 | Populating Next Right Pointers in Each Node
BFS Solution
class Solution(object): def connect(self, root): if not root: return queue = [root] while queue: curr = queue.pop(0) if curr.left and curr.right: curr.left.next = curr.right if curr.next: curr.right.next = curr.next.left queue.append(curr.left) queue.append(curr.right)
Metadata
Metadata
Assignees
Labels
No labels