Distributed Node Counting in a Linear Network

Problem

A finite, connected, acyclic linear network contains one or more nodes. Each node has at most one left neighbor and one right neighbor and can communicate only with its immediate neighbors...

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Standard Input
Execution Result: