Juspay Interview Experience

08 Dec, 2021
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 NodeGiven 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: 2Explanation: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:0Explanation:weight of 0th cell is 0.
There is only one node so
cell 0 has maximum weight.Largest Sum CycleGiven 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:3Explanation: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: -1Explanation:1 -> 0 -> 2 <- 3
There is no cycle in the graph.
Maximum Weight NodeGiven 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: 2Explanation: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:0Explanation:weight of 0th cell is 0.
There is only one node so
cell 0 has maximum weight.
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 CycleGiven 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:3Explanation: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: -1Explanation:1 -> 0 -> 2 <- 3
There is no cycle in the graph.
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.
Juspay
Interview Experiences
Writing code in comment?
Please use ide.geeksforgeeks.org,
generate link and share the link here.
Google SWE Interview Experience (Google Online Coding Challenge) 2022
Samsung Interview Experience Research & Institute SRIB (Off-Campus) 2022
Amazon Interview Experience for SDE 1
Amazon Interview Experience SDE-2 (3 Years Experienced)
TCS Ninja Interview Experience (2020 batch)
Write It Up: Share Your Interview Experiences
Samsung RnD Coding Round Questions
Nagarro Interview Experience
Amazon Interview Experience for SDE-1
Nagarro Interview Experience | On-Campus 2021