FastPrepLinked List of Binary Tree Nodes at a Given Level
Problems/Linked List of Binary Tree Nodes at a Given Level

Linked List of Binary Tree Nodes at a Given Level

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported in a first-hand Bloomberg 2019 new-grad phone screen. The returned value array projects the requested linked-list order.

Collect the binary-tree nodes at zero-based depth level from left to right, as if appending them to a new singly linked list. Return that list's values. Return empty when the level is absent.

Function

nodesAtLevel(root: TreeNode, level: int) → int[]

Examples

Example 1

root = [1,2,3,4,5,null,6]level = 2return = [4,5,6]
root
124536

The depth-two nodes appear left-to-right as 4,5,6.

Constraints

  • The tree contains at most 10^5 nodes.
  • level >= 0.

More Bloomberg LP Phone Screen questions

  • Pascal's TrianglePHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Valid Triangle NumberPHONE SCREEN · ONSITE INTERVIEW · Seen Dec 2026
  • Collatz Conjecture with Shared MemoizationPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Word SearchOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • N-ary Index-Path Encoder and DecoderPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Trapping Rain WaterPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Fewest Coins CombinationPHONE SCREEN · Seen Nov 2026
  • Recommend Films from Viewers Who Watched Everything You DidPHONE SCREEN · Seen Nov 2026
  • Track New Values in Sorted OrderPHONE SCREEN · Seen Nov 2026
  • Design Browser HistoryPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026

Similar questions at other companies

  • Link a Binary Tree in Spiral OrderExpedia · ONSITE INTERVIEWExpedia interview questions
  • Convert a Sorted Linked List to a Balanced BSTMeta · PHONE SCREENMeta interview questions
  • Maximum-Scoring Consecutive Tree LevelsJane Street · PHONE SCREENJane Street interview questions
  • Minimum Edits to a Perfect Binary TreeSnowflake · PHONE SCREENSnowflake interview questions
  • Find All Paths for a Name in a File SystemThe Walt Disney Company · PHONE SCREENThe Walt Disney Company interview questions
  • Binary Tree Spiral Level OrderAmazon · PHONE SCREEN · ONSITE INTERVIEW
  • Check a Complete Binary TreeGoldman Sachs · PHONE SCREENGoldman Sachs interview questions
  • Binary Tree Right Side ViewGoogle · PHONE SCREEN · ONSITE INTERVIEWGoogle interview questions
  • Same Binary TreeOdoo · PHONE SCREENOdoo interview questions
  • Binary Tree Zigzag Level Order TraversalLinkedIn · PHONE SCREEN · ONSITE INTERVIEWLinkedIn interview questions

Bloomberg LP interview experiences

  • Bloomberg AI-Assisted Coding Round, All Levels: 14 Experiences
  • Bloomberg SWE Intern Interview Questions: 68 Questions
  • Bloomberg Interview Questions, Level Not Reported: 65 Questions
  • Bloomberg Experienced Design & More: 126 Questions (Part 2 of 2)
  • Bloomberg Experienced SWE Interviews: 167 Questions (Part 1 of 2)
  • Bloomberg New Grad Coding Questions: 121 Questions (Part 2 of 2)
All Bloomberg LP interview questionsSee Bloomberg LP hiring insights
Saved
/**
 * Definition for a binary tree node.
 * public class TreeNode {
 *     int val;
 *     TreeNode left;
 *     TreeNode right;
 *     TreeNode() {}
 *     TreeNode(int val) { this.val = val; }
 *     TreeNode(int val, TreeNode left, TreeNode right) {
 *         this.val = val;
 *         this.left = left;
 *         this.right = right;
 *     }
 * }
 */
class Solution {
    public int[] nodesAtLevel(TreeNode root, int level) {
      // Write your code here.
    }
}
Checking account…