FastPrepOrder Employees by a Reports-To Hierarchy
Problems/Order Employees by a Reports-To Hierarchy

Order Employees by a Reports-To Hierarchy

Bloomberg LP logoBloomberg LP● MediumNEW GRADPHONE SCREEN

Updated Sep 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: Reported with a complete employee vector, reporting dictionary, and sample order in a first-hand Bloomberg interview. Equal-depth ties preserve input order.

names[i] has title titles[i]. Each reportsTo row is [subordinateTitle, managerTitle]. Define a title's depth as the number of reporting links to a top title.

Return employee names sorted by descending title depth. Preserve original order among employees with equal depth.

Function

orderEmployees(names: String[], titles: String[], reportsTo: String[][]) → String[]

Examples

Example 1

names = ["John","Sally","Sam","Drax","Bob","Daniel"]titles = ["Manager","CTO","CEO","Engineer","CFO","Engineer"]reportsTo = [["CTO","CEO"],["Manager","CTO"],["Engineer","Manager"],["CFO","CEO"]]return = ["Drax","Daniel","John","Sally","Bob","Sam"]

Engineer is deepest, then Manager, then CTO/CFO peers, then CEO.

Constraints

  • The title mapping is acyclic and each subordinate title has at most one manager.
  • At most 10^5 employees.

More Bloomberg LP Phone Screen questions

  • 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
  • Mutable Stock Price Top KPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Sparse Vector and Matrix OperationsPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Mutual-Friend Referral RecommendationsFireworks AI · PHONE SCREEN · ONSITE INTERVIEW
  • Mutual-Friend RecommendationsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions
  • Top K Users by Distinct ContactsGoogle · PHONE SCREENGoogle interview questions
  • Assign Campers to the First Arriving CarAtlassian · PHONE SCREENAtlassian interview questions
  • Resource Transition ProbabilitiesWhatNot · PHONE SCREENWhatNot interview questions
  • Resource Transition GraphIndeed · PHONE SCREENIndeed interview questions
  • Find Every Reachable Derived Vocabulary WordDuolingo · PHONE SCREENDuolingo interview questions
  • Rooms With Two Other Entrances and a Treasure SuccessorWalmart · PHONE SCREENWalmart interview questions
  • Parent and Child Counts for Every NodeKarat · PHONE SCREENKarat interview questions
  • Nodes With Zero or Three ParentsCompass International Holdings · PHONE SCREENCompass International Holdings 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
class Solution {
    public String[] orderEmployees(String[] names, String[] titles, String[][] reportsTo) {
      // Write your code here.
    }
}
Checking account…