Search⌘ K
AI Features

DIY: Populating Next Right Pointers in Each Node II

Understand how to populate the next right pointers in each node of an imperfect binary tree. This lesson guides you through implementing a traverse function that connects nodes horizontally, helping you master tree traversal techniques frequently tested in coding interviews.

Problem statement

You are given a binary tree that is not perfect. We have added an additional next pointer to our TreeNode implementation.

Populate each next pointer so ...