REACT:
The interviewer shared 5–6 React code snippets one by one and asked me to complete them. The focus was on assessing my understanding of React hooks and identifying which hooks to apply in different situations, such as useReducer, useCallback, and useMemo. While I have limited hands-on experience with React, I was able to answer around 50–60% of the questions.
DSA:
Q1 - Given some similar data set like this
[ robot1_tool1,
robot2_tool2,
robot1_tool3,
robot3_tool4,
robot2_tool1,
robot3_tool3 ]
Output:
tool1 - [robot1, robot2]
Q2 - Given a directed graph, you need to output root to leafs paths.
Eg: [
A -> [B, E, G],
C -> [D, F, I],
H -> [F, M, N]
]
-- Basically you need to find indegree 0 nodes and do a BFS
Result - PASS
Q1 - Given an array (0-indexed) of points difference of a team in a football match. you need to find the index where the team went from trailing to leading else return -1.
Input: [0, 1, 0, -1, 0, 1, 2, 1, 0]
Output: 5
Q2 - Follow up question on Q1
Now we have an arrary called rectifications,
[
time | score
[0 , +1],
[3 , 0]
]
Each rectification updates the score difference at the given time, and this correction should affect all subsequent values to the right of that index. After applying these rectifications, the task is to determine the same output as in Q1.
Result - There was a gap in my understanding of the problem initially, and I took some time to fully grasp the requirement. HM seems not satisfied. REJECTED !