Round 2 (Problem Solving) [1 hour]:
There is an exam room with n seats in a single row labeled from 0 to n - 1.
When a student enters the room, they must sit in the seat that maximizes the distance to the closest person. If there are multiple such seats, they sit in the seat with the lowest number. If no one is in the room, then the student sits at seat number 0.
Design a class that simulates the mentioned exam room.
Implement the ExamRoom class:
ExamRoom(int n) Initializes the object of the exam room with the number of the seats n.
int seat() Returns the label of the seat at which the next student will set.
void leave(int p) Indicates that the student sitting at seat p will leave the room. It is guaranteed that there will be a student sitting at seat p.
Question : https://leetcode.com/problems/exam-room/
I encountered this problem for the first time during interview. Initially interviewer asked to implement only seat() method which I was able to provide the solution in 2-3 minute using priority queue O(LogN). But when he asked to implement leave() method it was very inconvinient to use priority_queue for me. So I removed seat code itself and gave solution using set which was having complexity O(n) for seat and O(logN) for leave() method. I ran the code it was working fine. We still left with the 20-25 minutes in the interview , he asked me to optimise seat() complexity. I then used set<pair<int, int>> to maintain all interval in sorted order and two vector left and right to maintain recent left and right position of any index. I was able to ran the happy case. I already told him this code will require intense testing as we might not be covering edge cases like if last position becomes vacant and then we call seat().
Round 3 (Design) [1 hour]:
Design the multiplayer online chess game.
It is very standard design question.
Interviewer went in depth of databases choice and storage technique for list of moves and undo operations.
Round 4 (Bar Raiser) [1 hour]:
Mostly resume discussions.
Did you solve any scaling challenges in your project?
Most challeging project you have ever work on. About design discussions with seniors. Any project where requiements was so vague and how did you deal with it.
Your in depth knowledge of your work is checked.
Round 5 (Hiring Manager) [1 hour]:
Resume discussion similar to bar raiser. Again asked to explain the most challenging project in depth.
Behavioural questions like : Comments have you received in code reviews or comments I gave to other developers while reviewing, conflict with your manager/senior and how did you handle it.
Db and api discussion for my project. Asked me if I could have done better there or not.
Overall Feedback: Positive (I think I could have done better in machine coding round, if I had brush up the concurrency concept before interview)