Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Binary Tree Level Order Traversal

EasyPython00:00
Practice interviewer
In session
5 left
00:00

Your question is Binary Tree Level Order Traversal. Start with the requirements on the right.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.

Problem

Given the root of a binary tree, return the node values grouped by level from top to bottom and left to right. If the tree is empty, return an empty list.

Constraints

  • 0 <= number of nodes <= 2000
  • -1000 <= Node.val <= 1000
  • The input tree is a valid binary tree
Your solutionPython 3
You need to log in / sign up to run or submit.
Run your code to see test output