- Current company project in depth. We have used Kafka for some functionalities. Discussion on Kafka.
- Immutable classes.
- Discussion on hashmap. Why default size of hashmap is 16, why not 14 or 15.
- Discussion on Java 8 features. Why we should use streams, what’s the advantage.
- Print left view of binary tree. I gave recursive approach maintaining levels. Interviewer was satisfied with approach and implementation.
- Current project discussion. My role in project.
- Discussion on micro services.
- Implement HashMap. I started with implementing ‘put’ method first. After implementing ‘put’ he asked me to show what I have done. He discussed the various factors I had considered in implementing this method viz. equals, hashcode, bucket finding, collision handling etc. He was satisfied with the code and asked me to make this method thread safe. I haven’t worked on multithreading in any of my projects so little bit fumbled here. I used synchronized block in couple of places and upfront told him that I have never worked on multithreading before, just know theoretical concepts.
- Design AB testing software. Lets say you have one button in UI. Depends on incoming request this button can be of Red, Green or Blue color. Each color has weightage associated with it, lets say Red (50%) Green (30%) Blue (20%). Now you have incoming web requests, so your request distribution should be like for 50 % of web request button color should be Red, for 30 % of web requests button color should be Green and for 20% it should be Blue. You don’t know the total number of web requests. I gave 2-3 approaches to the interviewer but he wasn’t looked much satisfied.
This round goes for around 2-2.5 hrs. The good thing is interviewer gave me proper time to think and code both questions.
This round by taken by Director of Engineering.
Initial few questions were focused on current project and how much you have contributed in your project.
- He asked me about my role in current projects.
- What all innovative ideas you have given in project.
- Any architecture changes you have suggested in project.
- Biggest problem you have solved in your project and then discussion on the approach I have used to solve a latency problem in my current organization using Redis and Kafka.
Though these questions looks normal but their answers speaks length about your knowledge of current project, how innovative and flexible you are about technology and your appetite to accept new challenges . Don’t ignore these questions and prepare them well.
Then he asked to design url shortner (bitly links)
His expectation was it should be production ready design, so every minute details I have to think of.
I told him my approach and apis I will expose.
He told me to write method with signatures and return types I will be using. (Right from spring controller, all the method I will be invoking in order to complete the flow.)
We had discussion over methods and their signatures, he seems satisfied.
Then he asked me to design database schema for same.
Had discussion over the schema I have designed, usage of sql or nosql database for this usecase, caching and load balancing.
This round went for 1.5 hrs
After this round HR informed me that I was selected. 🙂
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course. In case you are prepared, test your skills using TCS, Wipro, Amazon and Microsoft Test Serieses.