FastPrepMinimum Rounds to Inform an N-ary Tree
Problems/Minimum Rounds to Inform an N-ary Tree

Minimum Rounds to Inform an N-ary Tree

Rippling logoRippling● HardINTERNFULLTIMEPHONE SCREEN

Updated Oct 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: The forwarding rules follow the report's linked tree-broadcast task. Numeric bounds are specified for practice; source match is about 95%.

The array parent describes a tree in which a node may have any number of children. Node 0 is the root, parent[0] = -1, and each other entry gives that node's parent.

At time zero only the root knows a message. In each round, every node that already knew the message at the beginning of the round may send it to at most one of its children that does not yet know it. Different informed nodes may send simultaneously. A child informed during a round can first send in the next round.

You may choose each node's child order. Return the minimum number of rounds needed to inform every node.

Function

minimumBroadcastRounds(parent: int[]) → int

Examples

Example 1

parent = [-1,0,0,0]return = 3

The root has three children and can inform only one per round, so three rounds are necessary.

Example 2

parent = [-1,0,0,1,3]return = 3

Inform node 1 first. In round two the root informs node 2 while node 1 informs node 3. Node 3 informs node 4 in round three.

Constraints

  • 1 <= parent.length <= 20000.
  • The array describes one valid tree rooted at 0.
  • A parent index need not be smaller than its child index.

More Rippling Phone Screen questions

  • Filter, Sort, and Deduplicate Scheduled TasksPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Stateful Log Transform and SearchPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Dependency-Aware Task SchedulerPHONE SCREEN · Seen Nov 2026
  • Delivery Cost Tracker with Effective-Dated RatesPHONE SCREEN · Seen Nov 2026
  • Camel CardsPHONE SCREEN · ONSITE INTERVIEW · Seen Nov 2026
  • Best and Worst Camel Card CompletionsPHONE SCREEN · Seen Nov 2026
  • Corporate Card Expense RulesOA · PHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • In-Memory Priority Task SchedulerPHONE SCREEN · Seen Oct 2026
  • Limit an Organization Tree's HeightPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
  • Median Across N Sorted ArraysPHONE SCREEN · Seen Oct 2026

Similar questions at other companies

  • Minimum Cameras to Monitor a Binary TreeOYO Rooms · PHONE SCREEN
  • Binary Tree CamerasAmazon · OA · PHONE SCREEN
  • Minimum Satellite Data Transfer IterationsHSBC · OAHSBC interview questions
  • Tree Path GCDNewton School · PHONE SCREEN
  • Split Array to Minimize the Largest SumNation with NaMo · PHONE SCREEN
  • File Encryption Tree OptimizationDatabricks · PHONE SCREEN · ONSITE INTERVIEWDatabricks interview questions
  • Lowest Common Manager for Employee GroupsGoogle · PHONE SCREENGoogle interview questions
  • Stock Profit With One, Unlimited, or Two TradesAdobe · PHONE SCREENAdobe interview questions
  • Maximum Path Sum Between Marked NodesDoorDash · PHONE SCREENDoorDash interview questions
  • House Robber IIIOkta · PHONE SCREENOkta interview questions

Interview reports that mention this question

  • Rippling Intern Interview History: 17 Experiences (Part 5 of 5)

Rippling interview experiences

  • Rippling Senior SWE Full Loop Questions: 1 Experience
  • Rippling Experienced SWE Phone Screens: 2 Experiences
  • Rippling Design Rounds and Onsites: 17 Experiences (Part 3 of 3)
  • Rippling Phone Coding Screens: 14 Experiences (Part 2 of 3)
  • Rippling SWE Screens and Loops: 31 Experiences (Part 1 of 3)
All Rippling interview questionsSee Rippling hiring insights
Saved
class Solution {
    public int minimumBroadcastRounds(int[] parent) {
        // write your code here
    }
}
Checking account…