Company: Juspay_7july
Difficulty: medium
Network Technician's Mission Problem Description In the city of Techville, a network technician named Sam inspects a newly built network of communication towers. The network is a rooted tree of N towers. The main control tower is tower 1 , and it is the root of the tree. Some towers stand in a safe zone and some stand in a hazardous zone. The outermost towers of the network are the ones Sam must inspect: a tower is outermost when it is not the control tower and no other tower hangs below it in the tree. (inferred - the source does not spell out what "outermost" means; a tower is outermost exactly when it is not tower 1 and has no children. Tower 1 is never counted, even when only one cable leaves it.) Sam is cautious. He will walk from the control tower to an outermost tower only if the walk never passes through a long unbroken stretch of hazardous towers. Precisely, look at the towers along the walk from tower 1 to the outermost tower, tower 1 and the outermost tower included, in orde