FrontendChallenges is a collection of frontend interview questions and answers. It is designed to help you prepare for frontend interviews. It's free and open source.
difficulty: medium
title: Level Order Traversal of Binary Tree
type: question
template: typescript
tags: javascript, blind75, binary-tree, bfs
Question
Given a binary tree root, return its level order traversal as a nested array, where each subarray contains the values of nodes at a particular level in the tree, from left to right.
Info
Question
Given a binary tree
root
, return its level order traversal as a nested array, where each subarray contains the values of nodes at a particular level in the tree, from left to right.Constraints:
Examples:
Template
index.ts
index.test.ts