Message on Whatsapp 8879355057 for DSA(OA + Interview) + Fullstack Dev Training + 1-1 Personalized Mentoring to get 10+LPA Job
0 like 0 dislike
in Interview-Experiences by Expert (30,360 points) | 597 views

1 Answer

0 like 0 dislike

Microsoft Interview Experience | Internship | On Campus | SELECTED


Total Rounds = 4 (Online Test + 2 Technical Rounds + 1 HR Round).


Round 1 :- Online Test 

It was conducted on mettl and we had 90 minutes to solve 3 questions. Questions were shuffled for everyone but were fairly easy.


1. Given a string we need to return a string in which each character should be increased by 3 units. Eg.

       adz -> dgc

The a becomes d, d becomes g and z becomes c. The only trick here was that we just had to complete the given function and they passed the string as a character pointer and so you need to see how to traverse a string represented as a character pointer.


2. Convert an infix expression to a postfix expression.


3. Given a string in the form of num1+num2=num3 in which one of them is X we need to find the value of X. Eg.

  Input : 5+X=7 

  Output: X= 2

  Input : 7+2=X

  Output: X=9

So this was basically an implementation based question and we just needed to find out which one of them was X and accordingly find the answer.


**48 students were selected for the interviews.


Round 2 :- Technical Round 1 

 I was asked 3 questions in this round. The questions were pretty easy.


1. Find the max and min element at any point in a stack. I was asked to code it. I tried to keep the interview interactive by telling him my approach as I wrote the code. I was asked to do a few dry runs, and he seemed satisfied with my approach.


2. Reverse a string. We discussed the stack question for about 20 minutes and I told him I will use a stack to reverse it, and he didn’t ask me to optimize it.


3. Mirror a given Binary Tree. I first told him my approach that we will use post-order traversal and then he asked me to code it.


I answered all the questions, so I was pretty confident that I will be selected for the next round.


Round 3 :- Technical Round 2 

1.Find the diameter of a tree (No. of nodes on the longest path in a tree).

   I had seen this question before and knew the solution so I just told him my approach and we    did a few dry runs on sample inputs before proceeding to the next question.


2. Given a number N we need to convert N to 1 by performing a minimum number of operations.         The allowed operations are:

 Subtract 1 from a number.

 Divide the number by 2.

 Divide the number by 3.



 Input: 10 

 Output: 3


 So at first, I was trying to generalize the solution by taking different cases. The interviewer  asked me to change my approach and I thought of a Dynamic Programming approach. 


#include <iostream>

using namespace std;


int main()


    int n = 10;


    int dp[n + 1];

    dp[1] = 0;

    dp[2] = 1;

    dp[3] = 1;

    for(int i = 4; i <= n; i++)


        dp[i] = dp[i - 1] + 1;

        if(i % 2 == 0) dp[i] = min(dp[i], 1 + dp[i / 2]);

        if(i % 3 == 0) dp[i] = min(dp[i], 1 + dp[i / 3]);







Round 4 :- HR Round 

It started with questions like tell me about yourself. I was prepared for this question and I kept the focus on my coding skills. For me, it was a mix of HR and technical rounds. 


So, he asked me questions on the Doubly Linked List. Given a pointer to a random node of a doubly linked list. Delete the node.


We discussed all the edge cases involved, and he just asked me to code it mentally and tell him each line. He seemed satisfied. Then he asked me why I wanted to work at Microsoft.  It was followed by questions on OOPS and Hashing.


He asked me what was the implementation of hashing in real life and how hashing is implemented internally. I was able to answer this but I didn’t know the technical terms. Finally, he asked me if I had any questions for him. Never give a no as an answer to this question as it shows that you are not interested in knowing about the company.

by Expert (30,360 points)