Grokking the Coding Interview: Patterns for Coding Questions
Ask Author
Back to course home

0% completed

Connect Level Order Siblings (medium)

Problem Statement

Given a binary tree, connect each node with its level order successor. The last node of each level should point to a null node.

Example 1:

Example 2:


  • The number of nodes in the tree is in the range [0, 2<sup>12</sup> - 1].
  • -1000 <= Node.val <= 1000

Try it yourself

Try solving this question here:




Like the course? Get enrolled and start learning!