YOE: ~10.3
Role: Lead Software Engineer/LMTS - Backend - Distributed Systems
Recruiter Approached.
2 Questions to be completed in 75 min.
Both were leetcode medium level.
This is a proctored test. Your microphone and video will be ON and recorded throughout.
Q1 : I solved it using binary heaps (Priority queue if you are using java). Once you figure out that you need to use a binary heap for this, its straight forward to solve. If you practice some good number of binary heap concepts, you will be able to solve this.
Watch out a little when handling inputs with large numbers.
Q2 : This was a little tricky question. You can solve this using basic DP or by using a combination of sorting and math. I chose to solve this using sorting and math. This question took some time to figure out the approach.
All the test cases were green for me for both the questions when I submitted the test. They will run another set of test suites after the submission.
I got the call back from HR the next day only communicating that we will be going ahead with next rounds of interviews.
It was virtual, over google meet.
Note: Excalidraw is my way of explaining. You might be good in a different way. Experiment and fix on on thing. Don't take me for granted :)
It was virtual, over google meet.
1. Its a connection pool of 1000 - 2000 connections
2. The developers who will use your interface can request for a connection.
3. If there is a free connection in the pool, you give the connection to the requester.
4. Once the connection is used by the developer, they can return back the connection to the pool Or close the connection.
5. If the connection is closed, create a new connection and keep it in the pool. The count of the connections should be maintained throughout.
6. A Connection will have 3 states - FREE, BLOCKED, CLOSED.
7. If the connections in the pool are exhausted, and requests for connections are coming from developers, keep an in-house mechanism to a default timeout and reject the request if there is no connection being freed within that default timeout. If you get a connection within the time, return the connection. Implemented this having many discussions with the interviewer. Throughout the interview, I was thinking out loud and explaining my thought process to the interviewer before I wrote every single line of code.
I had the buy-in from the interviewer for every logical step I reached in the implementation. This helped me in being clear with the approach and avoided revisiting what ii decided and wrote in the code.
The interviewer was particularly interested in how I handled the concurrency when there are multiple requests coming and we have only limited connections. I used a blockingQueue to maintain the pool and made the methods synchronous where even applicable.
With respect to the default timeout. I implemented this in O(n) for checking the connections in queue on thier status. I did this as we have only 1000 - 2000 connections. I called out that I am doing this in the interest of time and if the connections were in the range of 10^6, I will probably use 2 different blocking queues. One queue for closed and another queue for open connections. I said I will revisit this logic if I get time and added a TODO there in the code and went ahead with the rest of the implementation.
I made sure that I had checked all the requirements and I was out of time already.
Interviewer appreciated the callout I made for choosing O(n) and proposing a better solution before I moved on. He was ok with not implementing this in the code, as we already crossed the time.
The interviewer gave 5 min at the end for any questions I had to ask.
I got the call for Round 3 after 2 weeks from my Round 2
This was an in person round, whiteboard interview. Took place in the office.
This was an in person round, white board interview. Took place in the office.
I got the call from HR the next day hinting that the feedback was positive and confirmation call the following day.
Compensation details:
https://leetcode.com/discuss/post/7202836/salesforce-lmts-compensation-should-i-ne-q7kl/
I will add the preparation strategy later in a separate post.