Coding Challenge

Binary Tree Level Order Traversal

Medium
treebfs

Traverse a tree level by level.

Return the level order traversal of a binary tree as a list of value lists from top to bottom.

Examples

Input: root = [3,9,20,null,null,15,7]

Output: [[3],[9,20],[15,7]]

Constraints

  • Tree may be empty

Preparing your coding workspace...