Available question text
Each node of the tree represents a real machine in a cluster. Each machine in the cluster can only communicate with its parent and child nodes through "nodeld" using the following two methods: sendAsyncRequest(toNodeId. message) and receiveRequest(fromNodeId, message) . When a request reaches a machine, the receiveRequest method of that machine will be triggered automatically.
Suppose root machine (node 1 in the above tree) needs to have the ability to count and print out the total number of machines in the cluster, can you implement the node/machine class and its receiveRequest(fromNodeId, message) method to handle this case? There's no need to implement sendAsyncRequest (toNodeId, message), but you can call this method when needed.
Related questions
Continue with questions that share topics or the same question type.
- Clone N-ary Tree
Coding
- Diameter of N-Ary Tree
Coding
- Encode N-ary Tree to Binary Tree
Coding
- Find Root of N-Ary Tree
Coding
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
OpenAI
N- ary tree
Reported Jul 30, 2026 · 12 source reports
MID_LEVEL, SENIOR, STAFF
Source snapshot: Nov 12, 2026
View source