โœ๏ธ

Binary Tree Level Order

Medium๐Ÿท๏ธ Trees๐Ÿ“‚ Trees & Heaps
๐Ÿงฉ The problem

Return the values of a binary tree level by level, as a list of lists. (Tests give the tree in level order with null for gaps.)

Examples

  • [3,9,20,null,null,15,7] โ†’ [[3],[9,20],[15,7]]

๐ŸŽฏ Aim for: O(n) time

โœ๏ธ Write your solution

Pick a language, press Run to try it, then Run tests to check it against every test case โ€” just like a coding interview.

โ† All practice problems