Juspay Interview Experience Last Updated : 08 Dec, 2021 Improve Improve Like Article Like Save Share Report Round 1: It was an online round hosted of Juspay on Talscale. It consisted of 3 coding question. The coding question goes like this: Maximum Weight Node Given a maze with N cells. Each cell may have multiple entry points but not more than one exit(i.e entry/exit points are unidirectional doors like valves). You are given an array Edge[] of N integers, where Edge[i] contains the cell number that can be reached from of cell i in one step. Edge[i] is -1 if the ith cell doesn’t have an exit. The task is to find the node number of maximum weight node(Weight of the node is the sum of node numbers of all nodes pointing to that node). Note: The cells are named with an integer value from 0 to N-1. If there is no node pointing to the ith node then weight of the ith node is zero. Example 1: Input: N = 4 Edge[] = {2, 0, -1, 2} Output: 2 Explanation: 1 -> 0 -> 2 <- 3 weight of 0th cell = 1+2 = 3 weight of 1st cell = 0 (because there is no node pointing to the 1st cell) weight of 2nd cell = 0+3 = 3 weight of 3rd cell = 0 There are two cells which has maximum weight (i.e 0 and 3) Cell 3 has maximum value. Example 2: Input: N = 1 Edge[] = {-1} Output: 0 Explanation: weight of 0th cell is 0. There is only one node so cell 0 has maximum weight. Largest Sum Cycle Given a maze with N cells. Each cell may have multiple entry points but not more than one exit(i.e entry/exit points are unidirectional doors like valves). You are given an array Edge[] of N integers, where Edge[i] contains the cell number that can be reached from of cell i in one step. Edge[i] is -1 if the ith cell doesn’t have an exit. The task is to calculate the sum of the largest sum cycle in the maze(Sum of a cycle is the sum of node number of all nodes in that cycle). Note: The cells are named with an integer value from 0 to N-1. If there is no cycle in the graph then return -1. Example 1: Input: N = 4 Edge[] = {1, 2, 0, -1} Output: 3 Explanation: There is only one cycle in the graph. (i.e 0->1->2->0) Sum of the node number in that cycle = 0 + 1 + 2 = 3. Example 2: Input: N = 4 Edge[] = {2, 0, -1, 2} Output: -1 Explanation: 1 -> 0 -> 2 <- 3 There is no cycle in the graph. Like Article Suggest improvement Previous NetApp Interview Experience Next Tekion Interview Experience for Associate Software Engineer Intern+FTE | On-Campus 2021 Share your thoughts in the comments Add Your Comment Please Login to comment...