Code360 powered by Coding Ninjas X Naukri.com. Code360 powered by Coding
Ninjas X Naukri.com

Microsoft interview experience Real time questions & tips from candidates to crack your interview

Microsoft

4 rounds | 7 Coding
problems

Journey

My journey started when I was in class 12th and my teacher guided me to take part in the coding competitions that are hosted by codechef. After that I started participating in them and developed a habit of doing coding questions.

Application story

I was very excited to hear that Microsoft is coming to our campus for hiring. I always wanted to join Microsoft so I started preparing for the interview. Then the interviews started with 3 rounds as technical and 1 HR round.

Why selected/rejected for the role?

I was selected because I was ready for all sorts of questions as I had prepared well for the interviews.

Preparation

Duration: 2-3 months

Topics: Data Structures, Algorithms, OOPS, Operating System, Database Management, C++, or Java (proficient in anyone) Computer Networks.

Tip

Tip 1 : I would suggest practicing as many questions on data structures and algorithms as you can because it is the question practice that would help you in building your concepts strong. I practiced a lot of questions on InterviewBit and completed all modules of data structures and algorithms because there you can find the recent interview questions that you should know.

Tip 2 : If you have time for your interviews, I would recommend going through Leetcode as it has a good variety of questions sorted on topic wise difficulty level where you can try to solve at least 20-30 questions for each data structure and algorithm. Moreover, you should regularly participate in the weekly contests happening there so that you could know about your weak areas to improve.

Tip 3 : Along with coding you should be clear about some basic concepts of Operating systems and Databases that would help in your interviews. One more thing is that do some good research about the company's goal and vision and be prepared to ask some company-related queries that show your interest in the company.

Application process

Where: Campus

Eligibility: Above 8 CGPA

Resume tip

Tip 1 : Your Resume should consist of mainly skills, projects, and achievements. Projects would play a crucial part in your interview and you should have at least one most relevant and good project that shows how strong your concepts are in development.

Tip 2 : The most important tip is that never lie on your resume and like If you have worked upon some technology for the project part only and don't know the proper depth you could write basics only in your resume.

01

Round

Medium

Online Coding Test

Duration90 minutes

Interview date6 Aug 2020

Coding problem3

The round consists of 3 coding questions and the test was conducted on mettl platform. There was no sectional time limit for the coding questions. Every student got randomly 3 coding questions and none of the students got the same set of questions. The test was online with audio and video both on for continuous monitoring.

```
It can be shown that Mean and Median is in the form of P/Q, where P and Q are coprime integers and Q != 0. You need to return P and Q.
For Mode, if the highest frequency of more than one element is the same, return the smallest element.
For Example, for the given array {1, 1, 2, 2, 3, 3, 4}, the mode will be 1 as it is the smallest of all the possible modes i.e 1, 2 and 3.
```

Problem approach

The mean was easy to compute calculating the sum of the entire array, then I sorted the array for median and checked the size of the array. If the size was odd I returned the middle element else I returned the average of the two middle elements. For mode, I maintained a frequency array and returned the lowest element with maximum frequency.

Problem approach

I used the setprecision() method to round off the nth gp number.

```
As the answer can be large, return your answer modulo 10^9 + 7.
```

```
Can you solve this using not more than O(S) extra space?
```

Problem approach

I used dp to solve this problem with the Number of dice directly used as row index and the sum is directly used as the column index. In the end, I returned the last element of dp table.

02

Round

Medium

Video Call

Duration50 minutes

Interview date10 Aug 2020

Coding problem2

This round was based on data structures and some discussion regarding the projects. The interviewer was very calm and listened very carefully to the solutions. There was a lot of discussion on my projects and the interviewer seems to be very interested in knowing about the workflows of my projects.

```
For the trees given below:-
```

```
The given trees are identical as:-
1. The number of nodes in both trees is the same.
2. The number of edges in both trees is the same.
3. The data for root for both the trees is the same i.e 5.
4. The data of root -> left (root’s left child) for both the trees is the same i.e 2.
5. The data of root -> right (root’s right child) for both the trees is the same i.e 3.
6. The data of root -> right -> left ( left child of root’s right child) for both the trees is the same i.e 6.
7. Nodes with data 2 and 6 are the leaf nodes for both the binary trees.
```

Problem approach

I first solved the question with simple recursion by checking every node and then calling to the left and right subtree.

Then the interviewer asked me to optimize.

I explained to him then that if we have to check their identity we have to traverse both the tree fully.

He was satisfied with the explanation.

```
For the given string “deed” :
The possible subsequences are {“”}, {“d”}, {“e”}, {“de”}, {“e”}, {“de”}, {“ee”}, {“dee”}, {“d”}, {“dd”}, {“ed”}, {“ded”}, {“ed”}, {“ded”}, {“eed”} and {“deed”}.
As, {“d”}, {“e”}, {“de”}, {“ed”} and {“ded”} are repeated.
The distinct subsequences are {“”}, {“d”}, {“e”}, {“de”}, {“ee”}, {“dee”}, {“dd”}, {“ed”}, {“ded”}, {“eed”} and {“deed”}
Thus, the output will be 11.
```

```
As the answer can be large, return your answer modulo 10^9 + 7.
```

Problem approach

I solved this question using recursion and map. I made two recursion calls one for including the element and one for excluding the element and then after reaching the end of the array I push the subsequence to the resultant vector. I also checked for duplicates using the map.

The interviewer was satisfied with this approach after I explained to him the workflow and that since we want all the subsequences so we need to use recursion.

03

Round

Medium

Video Call

Duration50 minutes

Interview date10 Sep 2020

Coding problem1

This round was also based on data structures and the interviewer was not responding as much as in the first round so that I should think on my own that whether I am on right track or not. In this round also there was a deep discussion on one of my web development with machine learning project. So don't panic in these situations If the interviewer is not responding much because he is noting down every tiny detail of your written code.

```
Input : 1 -> 2 -> 3 -> 4 -> 'NULL' and 'K' = 2
Output: 1 -> 2 -> 4 -> 'NULL'
Explanation:
After removing the second node from the end, the linked list become 1 -> 2 -> 4 -> 'NULL'.
```

Problem approach

I first founded the length of the linked list and then took the difference of length and N, which would give me the node to be deleted from the beginning. After I got the index of the node to be deleted from the front I simply traversed the list up to that node and deleted it from memory.

The interviewer asked me to optimize the solution.

So, the above solution was taking O(2n) time, I optimized the solution to O(n) using two pointers approach by maintaining first and last pointers. The first will point to the head of the linked list and the second will point to the Nth node from the beginning and now keep increment both the pointers by one at the same time until the second is pointing to the last node of the linked list. In this way, I can delete the Nth node from last because I got the address of the node to be deleted.

The interviewer seemed to be satisfied with this approach.

04

Round

Medium

HR Round

Duration30 minutes

Interview date10 Aug 2020

Coding problem1

This was an HR/Coding round and was the final one. The coding question was to find the nth node from the end of the linked list which is similar to the one asked in the previous round. The interview started with 2-3 HR questions and after I answered all of them, there was a serious discussion on my projects like why did you chose this project, what are its advantages, was it able to solve the existing problem. I answered all the project related queries very calmly and he was satisfied.

What do you expect from this internship?

Where do you see yourself 5 years down the line?

What are your weaknesses?

Problem approach

Tip 1 : For the first question, I answered like this that I expect constant learning and growing from this internship and wanted to contribute something to improving the standards of the people in the technical world. You should always be clear towards your goal and how it would help the company and you too in growing as an engineer.

Tip 2 : For the second question, I answered this by breaking the intervals and telling my exact plan that for the first 2-3 years I want to become such an expert in my field that If there is any problem related to that in the company, I would be the first person to be approached and in later years, I want to explore the field of being a manager whose work is to give advice on to how to lead any real-time project.

Tip 3 : For the weaknesses, the tip is that one should never hesitate in telling his/her weaknesses but that should also not be the case that you start telling a lot of your weaknesses. You should tell only 1-2 weaknesses and that too not much relevant to the job description so that your weakness also seems your strength to the interviewer.

Tip 4 : Do thorough research of the company and ask some relevant questions in the end if given chance, which really gives a good impression of yours. Also, have an in-depth knowledge of your project because that would be asked in almost every rounds.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Suppose list1 is [2, 133, 12, 12], what is max(list1) in Python?

Choose another skill to practice

Similar interview experiences

SDE - Intern

3 rounds | 8 problems

Interviewed by Microsoft

1619 views

2 comments

0 upvotes

SDE - Intern

3 rounds | 6 problems

Interviewed by Microsoft

972 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 5 problems

Interviewed by Microsoft

1480 views

0 comments

0 upvotes

SDE - Intern

2 rounds | 4 problems

Interviewed by Microsoft

138 views

0 comments

0 upvotes

Companies with similar interview experiences

SDE - Intern

3 rounds | 6 problems

Interviewed by Amazon

13502 views

4 comments

0 upvotes

SDE - Intern

2 rounds | 4 problems

Interviewed by Amazon

8992 views

2 comments

0 upvotes

SDE - Intern

3 rounds | 4 problems

Interviewed by Amazon

5994 views

3 comments

0 upvotes

sir one question i would like to ask you

dear sir the question is that i am very weak in speaking english .

then waht would be do from my side.

pls give me suggestion