# Microsoft Internship Interview Experience (On-Campus)

• Last Updated : 23 Nov, 2021

Round 1(Online Coding Round – 90 mins): The online test was conducted on https://mettl.com/. There was 90 minutes to solve and code 3 Problems. The questions were based on basic Implementation Problems (Commonly found in CodeChef, Codeforces, GeeksforGeeks and other online platforms). Among the three questions, two were easy and one was of mediocre difficulty.

1. You are given n passwords. You have to print total number of distinct password. On each password you can perform operation any number of times possibly zero. The operation is defined as you can swap data present on any 2 index of a string if the difference of index number is even i.e. swap(a[i], a[j]) if (j-i)%2==0.
Test Case: Input:  n=5 and
passwords are=[“abcd”, “cdab”, “bacd”, “bdca”, “cdba”]
Output: 2

Explanation: as “cdab” can be converted to “abcd ” and “bdca”, “cdba” can be converted to “bacd” so you can get only 2 distinct password.

2. Today is Anshul’s birthday so he brought n chocolates and he had k friends. He has to distribute all the chocolates to friends in the following way. The first child gets 1 second gets 2 third gets 3 and so on so if there are enough chocolates then kth child gets k chocolates. Now if chocolates are still remaining then he gives again k+1 chocolate to first child k+2 to second child and so on till he distributes all the chocolate. So you have to print k integers defining which child got how many chocolates.
Test Case:
Input: n=25 and k=5
Output: [7  6  3  4  5]

Explanation: so in first go the chocolate distribution would be as [1  2  3  4   5] so total 15 chocolates are used now in second go 1st child will get 6 more candies so his total candies would be 7 now we are just left with 4 more candies so that would be given to second child as he can get more as much as 7 chocolates but  we have only 4 left. So the final answer would be [1 2 3 4 5] + [6 4 0 0 0] = [7 6 3 4 5]

3. You are given M for modulo and N number of layers. Now in first layer you have 1 ship of power v=2. Now for every ship in layer i with power v there are distinct ships of power 0 to v*(v+1)%M-1 in in its next layer. Now you are given M and N. You have to find total number ships in all layer % M.
Test Case:
Input: M=4 N=2
Output: 3

66 students were selected for the next round.

Round 2(Group Fly Round): 45 mins: In this round, we all were given one question to solve within 45 minutes. We had to write functions on A4 paper (in any programming language or pseudocode) returning the answer and their Time and Space Complexity. We were advised to write as many solutions as possible for the problem but the most optimal solution would be considered.

1. Given an array of size ‘n’.The question was to shift all the zeros present in the array to the right of the array maintaining the order of non-zero elements.

Examples:

Input :
array : [0, 10, 7, 0, 0, 0, 8, 0, 3, 6]
n: 10
Output :
array : [10, 7, 8, 3, 6, 0, 0, 0, 0, 0]

42 students were selected for the next round.

Round 3(Technical Interview 1 – Around 45 mins): The Interviewer asked questions about Concepts of Object-Oriented Programming, Data Structures and Algorithms. The Interviewer described some scenarios and asked how to tackle them with OOP concepts like Virtual Function, Multiple Inheritance, Operator Overriding etc.

1. Given two strings P and Q, the question was to check if the two strings are a permutation of each other or not.

Examples:

Input :
string P: ‘aBca’ and string Q: ‘Baac’
Output :
P and Q are permutations of each other.
2. There are ‘n’ buildings in a street. A monkey can cross one or two buildings in one jump. In how many possible ways the monkey can reach from the first building to the last building?

Examples:

Input :
n = 4
Output :
no. of possible ways: 3
Explanation :
The possible ways can be
(1->2->3->4; 1->3->4; 1->2->4)

For each question, I wrote C++ functions on paper and he asked me to explain the time and space complexity of my solutions and the possible corner cases. He also discussed other possible approaches to solve the problems.

Round 4 (Technical Interview 2 – Around 30 mins): In this round, I was asked to solve some Real-life problems using DS and Algorithms Concepts and some puzzles.

• Given a hyperlink of a website Homepage, my task was to print all the ‘dead links’ present on that website. A list of links present in each webpage was also given for each page of the website.
• Then the interviewer asked to solve and explain some mathematical and logical puzzles.

Round 5(HR Interview – Around 20 mins): At first, the interviewer asked me to introduce myself and my journey from my school to my College.

• Then he went through my CV and asked about my project and skills. He asked me some logic based Questions.
• Then he asked me what I liked in their Pre-Placement Talk and why I wanted to join the Company.

The result was published within two hours and I was selected along with 9 other students (my batchmates).

Verdict: Selected

My Personal Notes arrow_drop_up