N- ary tree
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Late July, 2026
Late July, 2026
Mid July, 2026
Hello Interview Premium
Your account is free and you can post anonymously if you choose.