Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Converging Maze: Maximum Weight Node You are given a maze with N cells. Each cell may have multiple entry points but not more than one
Converging Maze: Maximum Weight Node You are given a maze with N cells. Each cell may have multiple entry points but not more than one exit (ie. entry/exit points are unidirectional doors like valves). The cells are named with an integer value from 0 to N1. You have to find: Find the node number of maximum weight node (Weight of a node is the sum of node numbers of all nodes pointing to that node) INPUT FORMAT 1. An integer T, denoting the number of testcases, followed by 2T lines, as each testcase will contain 2 lines. 2. The first line of each testcase has the number of cells N. 3. The second line of each testcase has a list of N values of the edge[] array. edge[i] contains the cell number that can be reached from of cell 'i' in one step. edge[i] is 1 if the ' i 'th cell doesn't have an exit. OUTPUT FORMAT 1. First line denotes the node number with maximum wight node. Sample Input 1 23 44141388808149151111015222222222221 Sample Output 22 Function Description N/A Function Description N/A Constraints N/A
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started