Round 1
Questions:
-
You are given a method which you need to complete. You need to return the closest manager common to two employees.
public Emp getCommonManager(Emp e1, Emp e2) { // Write your solution }
You can design the Emp class however you like. But given two employees, you need to find the closest manager common to both of them.
-
Given an array, find any subarray which has a sum of 0.
Candidate's Approach
The candidate was able to solve both problems, making a few mistakes initially but rectifying them immediately upon the interviewer's feedback. The interviewer was described as kind and collaborative yet firm.
Interviewer's Feedback
The interviewer felt satisfied with the candidate's answers to the additional questions, which included topics on Java Records, Spring Interceptors, and handling double payments.
Round 2
Questions:
- Implement builder pattern in a thread-safe way (LLD).
- Shorten URL from a long URL for a MakeMyTrip booking.
Candidate's Approach
The candidate implemented the builder pattern and added locks where necessary but was informed that synchronized is blocking in nature. The candidate faced challenges with static methods and classes, which led to some mistakes. For the URL shortening problem, the candidate provided a solution based on knowledge of the TinyURL system design, discussing session management and authentication.
Interviewer's Feedback
The interviewer noted that the candidate's HLD was good, but the LLD was not up to the mark.