Phone Screening [Sept 2024]
Questions: There are n number of routers connected to each other at some distances. A source router src will receive a message and broadcast it to all routers within specified distance d. Return True/False whether destination router des got the message or not. (Simple BFS algorithm).
Given: router names and their distances, src, des and d.
Follow-up Question:
Message goes only to first nearest router. Return True/False for the same question.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 1 [Oct 2024]
Questions: Given a tree with each node having a weight. Find min weight required to disconnect all leaf nodes.
-
Example 1: Weight: A-B: 2 A-C: 4 B-D: 2 B-E: 1
(A has 2 child nodes: B and C. B has 2 child nodes: D and E)
Answer: 6 (Cut node C and Node B) -
Example 2: Weight: A-B: 3 A-C: 4 B-D: 1 B-E: 1
(A has 2 child nodes: B and C. B has 2 child nodes: D and E)
Answer: 6 (Cut node C, Node D and Node E)
No follow-up questions as got nervous while solving this and messed up time complexity.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 2 [Oct 2024]
Questions:
Compute: add(sub(-5,10),mul(5,pow(2,5)))
(Used stack)
No follow-up questions as this coding only took time.
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 3 [Oct 2024]
Questions: Googlyness
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.
Round 4 [Oct 2024]
Questions:
Given inbuilt function query(L,R) which returns 1 if subarray(L,R) has digit '1' else returns 0. You are not given the binary array arr. Return a list of indexes having digit '1'.
N = number of digit '1' in array arr = 10^5
M = size of arr = 2^62 - 1
- Example: (The array is: 011000100) return: 2,3,7
Note: Array arr is not given, just utilize function query(L,R) to find these indexes.
Follow-up Question:
In this case, query(L,R) function returns the number of digit '1' in the subarray(L,R). You are given N, k. Return N/k number of subintervals each having k number of digit '1'.
- Example: (Let the array arr be: 01100010100)
return: [0,4] and [5,10] or [0,3] and [4,10]
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.