Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started

Binary Tree Level Order Traversal

Easy
EasyCodingQueueTrees
Asked 2w ago|
Manpower Belgium
Manpower Belgium
Asked 55 times

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
Practicing as: AI Engineer interview at Fujitsu

Hi, I'll play your Fujitsu interviewer for the AI Engineer role. Candidates describe these interviews as mostly positive and moderately difficult, so expect me to be friendly and conversational. Take your time with the question above and answer like we're in the room.

Take this as a live interview session →

You are practicing as a guest. Sign up free to run your code against the sample data. Your draft stays right here.

Sign up freeI have an account
def solve(rows):
    counts = {}
    for row in rows:
        ...
    return result
Sign up to unlock solutions
Dialpad Software Engineer Interview QuestionsCox Communications Solutions Architect Interview QuestionsGenpact Software Engineer Interview QuestionsDel Rey Systems & Technology Interview QuestionsBourntec Solutions Interview Questions
Next questions
SalesforceBinary Tree Inorder TraversalEasyBellBinary Tree Preorder TraversalMediumPalo Alto NetworksBinary Tree Right Side ViewMedium