Round 1: Codility Assessment
Q1) Fair Indexes Q2) Count number of balanced nodes, in a n-ary tree, balanced nodes are the ones where each child has the same number of immediate children. For example, if a node x has children a, b, c, and d, then node x will be balanced only if the number of immediate children that each of nodes a, b, c, and d have is the same. (Answer: Recursively compute bottom-up DFS).
I would rate this round as medium difficulty. The time limit was 70 minutes, and the challenging part is that once a solution is submitted, you cannot know whether your code passed all the test cases, nor can you update your solution; therefore, you must be absolutely sure when submitting.
Verdict: I cleared this OA and was invited for a Teams interview.
Round 2: DSA + Minor Multi-threading Follow-up
Q1) Implement Queue using a fixed-size Array. This was again on Codility, and you are not allowed to run the code. The interviewer will only tell you whether the code has bugs or not and will expect you to figure them out. They will also want you to write down the test cases on which you would test your code.
Q2) Follow-up on Q1: Since the array has a fixed capacity, and once the array is full, you cannot insert more items into the queue, implement a logic where a thread would block the insert operation until another thread pops from the queue so that the first thread can insert into the queue. (Answer: You can use a simple lock around the insert function and an inner while loop to wait until the queue is not at full capacity). This was the approach I came up with, which might be wrong, but the interviewer did not raise much concern.
Then we discussed the tech stack and production-grade applications where multi-threading is very important (nothing technical, just casual conversation).
Verdict: I have not heard back from the recruiter since, nor has the career portal application status been updated.