PracHub
QuestionsPremiumLearningGuidesCheatsheetNEW
|Home/Coding & Algorithms/Bloomberg

Find root from child adjacency lists

Last updated: Mar 29, 2026

Quick Overview

This question evaluates understanding of tree data structures, set-based membership reasoning, and algorithmic analysis including time and space complexity and robustness to invalid inputs such as multiple roots or cycles.

  • Medium
  • Bloomberg
  • Coding & Algorithms
  • Software Engineer

Find root from child adjacency lists

Company: Bloomberg

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: Medium

Interview Round: Technical Screen

You're given an unordered list describing a rooted n-ary tree. Each item is a record of the form {id: int, children: set<int>} listing a node's direct children; parent links are not provided. All node ids are unique, and every non-root node appears exactly once in some children set. Find and return the root node id. Describe the algorithm, data structures used, time and space complexity, and how you would detect/handle invalid inputs such as multiple roots, cycles, or missing references.

Quick Answer: This question evaluates understanding of tree data structures, set-based membership reasoning, and algorithmic analysis including time and space complexity and robustness to invalid inputs such as multiple roots or cycles.

Related Interview Questions

  • Solve meeting and tree problems - Bloomberg (easy)
  • Minimize travel cost with two cities - Bloomberg (easy)
  • Check connectivity between two subway stations - Bloomberg (easy)
  • Design a data structure for dynamic top‑K frequency - Bloomberg (hard)
  • Find tree root and bucket numbers - Bloomberg (hard)
Bloomberg logo
Bloomberg
Sep 6, 2025, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
2
0

You're given an unordered list describing a rooted n-ary tree. Each item is a record of the form {id: int, children: set<int>} listing a node's direct children; parent links are not provided. All node ids are unique, and every non-root node appears exactly once in some children set. Find and return the root node id. Describe the algorithm, data structures used, time and space complexity, and how you would detect/handle invalid inputs such as multiple roots, cycles, or missing references.

Comments (0)

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Bloomberg•More Software Engineer•Bloomberg Software Engineer•Bloomberg Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 7,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.