Company: Cisco_8th june_on campus

Difficulty: medium

Problem Statement

A distributed system of servers forms a tree of tree_nodes nodes, numbered 1 through tree_nodes . The tree has exactly tree_nodes - 1 edges, each bidirectional, and crossing any single edge between two directly connected servers costs 1 unit of time. A worker process needs to: Begin at server start_node . Perform a task at every server listed in the array task_nodes[] (of size num_tasks ), in whatever order is most convenient. End up at server end_node . The process advances one edge per step, and it's free to revisit servers or edges as many times as it needs to. Work out the least total time needed to start at start_node , finish every task, and arrive at end_node . Note: The given graph is always a tree (connected, with exactly tree_nodes - 1 edges). Edges are bidirectional. task_nodes[] contains distinct elements. start_node is not equal to end_node , and start_node is not present in task_nodes[] . Input format The program reads from standard input: The first line contains a single

More Cisco_8th june_on campus OA questionsInterview experiences