I applied on the career website many times and some of my friends referred me as well. I was approached by a recruiter on LinkedIn and called for the interview process next day. I did not get much time to prepare since I was told to appear next day for the interview.
Interview Process:
Round 1: Data Structure & Algorithm based + Project Discussion (1 hour)
The round started with brief introduction, hobbies and interests.
Q1- Given two numbers represented by two linked lists, write a function that returns the sum list. The sum list is linked list representation of the addition of two input numbers.It is not allowed to modify the lists. Also, not allowed to use explicit extra space (Hint: Use Recursion). Example: ` Input: First List: 5->6->3 // represents number 563 Second List: 8->4->2 // represents number 842 Output Resultant list: 1->4->0->5 // represents number 1405
` Discussed my approach with the interviewer and when he was convinced with my approach, I was told to write prod-ready code.
Q2 - Given a string, find the length of thelongest substringwithout repeating characters. ` Example 1: Input: "abcabcbb" Output: 3 Explanation: The answer is "abc", with the length of 3.
Example 2: Input: "bbbbb" Output: 1 Explanation: The answer is "b", with the length of 1. `
I told him the two pointer approach and wrote down the code. He was convinced with the solution.
Q3 - Discussion about the current work experience, technologies involved in current project and a quick walkthrough my resume.
Round 2: Data Structure & Algorithm based + Project Discussion (1 hour)
This round started with deep discussion about my project. The interviewer went through my resume and checked my competitive programming profiles mentioned in the resume. He asked about the last contest that I gave on Codechef and discussed some stuff about competitive programming.
Q1 - Given the first 4 terms of a sequence - 1, 11, 21, 1211…. Find the nth term. I told him the O(N) approach. I was told to write prod-ready code. He tested it for few cases and in the end, he was satisfied with the solution.
Q2 - Given an array of strings, group anagrams together.
Example: Input: ["eat", "tea", "tan", "ate", "nat", "bat"], Output: [ ["ate","eat","tea"], ["nat","tan"], ["bat"] ]
It was a pretty straight forward question.
Q3 - Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.
`
Example:
Input: The root of a Binary Search Tree like this:
5
/
2 13
Output: The root of a Greater Tree like this:
18
/
20 13
`
The answer was expected in a single pass with prod-ready code.
Round 3: Computer Science Fundamentals + Project Discussion (1 hour)
This round started with deep discussion about my intern project.I was asked to explain the project, the algorithm's used in the project and improvements I can do in the project with the current tech skills I posses. The discussion went on for 15-20 minutes.
Question related to Computer Science Fundamentals : 1.Operating System questions related to mutex-semaphore, deadlock, banker's algorithm, Paging and Page Replacement Algorithms. 2.ACID properties (DBMS). 3.Then I was given a table and was asked to write SQL queries for specific conditions. Two such questions were asked.
Question related to Shortest Path Algorithm : I was given n cities and I needed to find out the shortest path of all cities from a particular city. And further, if shortest path needed to be found out from all sources, what modifications can be done? Algorithms used in Maps App. (Dijkstra, Floyd-Warshall and A-star Search)
Discussion about the work and tech stack of the team for which I was being interviewed.
Round 4: Behavioural Questions+ Design Problem + Project Discussion (1 hour)
Result : After 15-16 days of the last round, I got a mail for selection.
Pro-tips :
This was my interview experience with Microsoft. It may vary from person to person.