Hello folks, I’m back with and exciting article in this interview experiences series. Hope you all like the Amazon Interview Experience one. Let me share an exciting opportunity like that and quickly jump directly into it.
Okay, while just casually working on Mondays, I got to hear from my Colleague. That, he got an offer from Kotak for SDE-2 position. After that the very next day. I asked him to share my resume with that recruiter. Just in case they have more SDE openings like that. Luckily, they were hiring for SDE-1 as well. So, I got an email from that recruiter as well to share some the basic details.
Interview Structure
- Bar Raiser round
- Technical Round 1
- Technical round 2
- Techno – Managerial Round
- HR discussion
Bar Raiser Round
I was also a bit confused like you or other, what’s this mean. Its basically kind of a screening round that is taken by some Hiring Partner of Kotak.
So, this round will be an hour long. And, will cover problem solving, Low Level Design and High Level Design as well. Its very structured and duration was distributed into(30-15-15) minutes. Its kind of how much high I can score in each section.
Coding Question1: Search element in a sorted rotated array
Solution:
class Solution {
public int findPeak(int[] nums, int l, int r){
if(l==r){
return l; // peak at last i.e., array is sorted & not rotated
}
int m = (int) l+(r-l)/2;
if(m==0 && nums[m]>nums[m+1]){
return m;
}
if(m>0 && m<r && nums[m]>nums[m-1] && nums[m]>nums[m+1]){
return m;
}
else if(nums[l]>nums[m]){
return findPeak(nums,l,m-1);
}
else{
return findPeak(nums,m+1,r);
}
}
public int binarySearch(int[] a, int l, int r, int t){
if(l<=r){
int m= (int )l+(r-l)/2;
if(a[m]==t)
return m;
else if (a[m]<t)
return binarySearch(a,m+1,r,t);
else
return binarySearch(a,l,m-1,t);
}
else
return -1;
}
public int search(int[] nums, int target) {
int n=nums.length;
int ind = findPeak(nums,0,n-1);
int left = binarySearch(nums,0,ind,target);
int right = binarySearch(nums,ind+1,n-1,target);
return (left==-1 && right == -1)?-1:((left==-1?right:left));
}
}
I easily managed to do it within 25 minuted with explaining approach, time &space complexity. Next comes the Low Level and High level design part. Has asked me brief my work experience and the problems that I has solved. Then, he asked some general terms related to load balancer, caching, sharding and messaging queues. Its was hardly for 10 minutes long.
For the low level design he asked me to just design a Database schema for a payment gateway. It was not expected to design the full proof solution, just the basic tables included. Since, I have already some work experience and learned how to do it. So, it was easy for me also I explained some design patterns like Strategy and facade which needed over there.
So, This round went smooth and after around 10 days, I suddenly received invite for further 2 technical rounds together.
Technical Round 1
Its also an hour long and the interviewer showed up. At the beginning only he started by giving DSA question.
Question 1: Given an array, find the next smaller element to the left of each element in the array. Its the same as Next Greater Element question on leetcode.
Question 2: Given an array of 0’s and 1’s in which. 1’s are the person infected and 0’s are uninfected. at every unit time, the uninfected one will be infected by their adjacent infected ones. Calculate the total time required for the all person to get infected.
Input: nums = [0,0,0,1,0,1,0,1,0,1]
Output: 3
Explanation: At first time unit the array will look like [0,0,1,1,1,1,1,1,1,1], at t=1
At second time unit the array will look like [0,1,1,1,1,1,1,1,1,1] , at t = 2
At third time unit the array will look like [1,1,1,1,1,1,1,1,1,1] , at t = 3
Solution:
public class CoronaVirus {
public int calculateTimeToInfected(int[] persons, int n){
Queue<Integer> queue = new LinkedList<>();
int time = 0;
for(int i=0;i<n;i++){
if(persons[i]==1){
// add all infected persons
queue.add(i);
}
}
while(!queue.isEmpty()){
int size = queue.size();
for(int i=0;i<size;i++){
int infectedIndex = queue.poll();
if(infectedIndex-1>=0 && persons[infectedIndex-1]==0){
// check for infected persons to the left
persons[infectedIndex-1] = 1;
queue.add(infectedIndex-1);
}
if(infectedIndex+1<n && persons[infectedIndex+1]==0){
// check for infected persons to the right
persons[infectedIndex+1] = 1;
queue.add(infectedIndex+1);
}
}
// increment time
time++;
}
return time-1;
}
public static void main(String[] args) {
int[] persons = {0,0,0,1,0,1,0,1,0,1};
int n = persons.length;
CoronaVirus coronaVirus = new CoronaVirus();
System.out.println(coronaVirus.calculateTimeToInfected(persons,n));
}
}
Technical Round 2
Since, I had good feedback till here, and the interviewer for this round was pretty chill enough and relaxed. He asked my about myself and hobbies. After that he given me some questions to solve.
Question 1: Its a pretty standard question on stack, Asteroid Collision
Question 2: Containing most water between height of the given pillars
This round was also, a piece of cake. Since, all question were pretty standard and I has practiced them a lot. After 3-4 days, I received the feedback that I have cleared them, there will be one last final round
Techno – Managerial Round
The round started, and two interviewers were there at the call. At the very beginning the one, I think manger said that there will be 2 coding question.Also, I have to come up with working solution within 1 hour. Without any introduction, he given the question.
Question 1: Its also a pretty standard question and graph, Rotten Oranges.
So, I started with the explaining them the approach. Also, one thing since I had already solved the question earlier. Still, I haven’t practiced problem solving for around 4-5 months. So, there were my syntax errors. Along with, that I confused with the time and space complexity also. And, this took me around 35 minutes to solve the question.
Question 2: Course Schedule-2
Its, was my bad luck or what, I had only 25 minutes left and he asked me this question. Anyway, I started with the approach and since, its not that type of question. That, easily comes to mind, I struggled a little and able to find the solution in 15 minutes. We both agreed on the approach and I started coding it up. Since its a graph problem definitely, gonna take a little more time to code. So, I took another 15 minutes to code it and working perfectly.
In a total I took 1 hour 15 minutes, to complete the round. I thought that okay anyway, if a took a little extra time least I’m able to solve it.
After 2 days, I received the feedback that I’m not selected and they mentioned that “Areas to improve: Coding Speed”. Really!!, I didn’t like how rigid this round was. Possible that there were a large pool of candidates and they I have already selected some else. But, I don’t know the exact reason. One thing for sure, Coding speed matters, But after clearing these many round. And for final round they didn’t select me for taking 15 minutes extra. And both questions were lengthy enough. Any ways, Its just a matter of luck!!.
I hope you folks enjoy this article and find this one helpful in your software engineering interviews. Feel free to ask any question in the comment section, I will comes up with the answers. Till then Good Bye!! and see you on the next article. HAPPY CODING….