Microsoft IDC Internship Interview (On-Campus)
The online round was conducted on mettl.com. There were 3 coding questions to be done within 90 minutes. There were various sets of questions. My set consisted of the following:
1- Given a Java program as a string, check if the parentheses are balanced or not.
2- You have a stack consisting of 2 types of tiffins, 1s and 0s. There’s also a queue of students waiting in line to collect the tiffin of their preference (either 1 or 0). If the student at the front of the queue gets the tiffin of his choice, he collects it and leaves the queue, otherwise he re-joins the queue at the back. Write a function to calculate the number of students who do not get the tiffin of their choice.
3- Your Pikachu is fighting Mewtwo in a pokemon battle. Your Pikachu has a set of attacks which have been provided to you as an array of strings and another string describing the entire battle. Pikachu can win only if it performs all the attacks one after the other in any sequence. Write a function which returns the index at which its winning move starts, else return -1.
Eg. Input: [thunderbolt, slam, agility, growl]
60 students were shortlisted out of 523 after this round.
II) WRITTEN ROUND
All the shortlisted students were given the same question for which they had to write a code within 45 minutes.
— Given an interval series having elements of the form [start, end] and another interval. The objective is to incorporate the provided interval in the interval series such that there’s no overlap i.e a number is present only in one unique bucket.
About 30-35 students made it through this round.
III) ROUND 1 (Technical)
1- Write a function that takes 2 parameters, an integer and a Node pointer which points to a node of a sorted circular linked list. The function should insert the element in its correct position in the list and return pointer to the newly inserted node. (NOTE: The linked list does not have a head. And the Node pointer passed as an argument could be pointing to any node in the list)
IV) ROUND 2 (Technical)
1- Given an n x n matrix and a number x, find the position of x in the matrix if it is present in it. Otherwise, print “Not Found”. In the given matrix, every row and column is sorted in increasing order.
2- Write a function to connect all the adjacent nodes at the same level in a binary tree.
3- Write a program that, given an array A of n numbers and another number x, determines whether or not there exist two elements in S whose sum is exactly x.
4- Explain polymorphism.
– Suppose you’re a businessman who deals in gold. Your technical team predicts the cost of gold in the market on each day over the next week. Find the days on which you should buy and sell gold to maximize profit. (Version 1: You can buy and sell only once. Version 2: You can buy and sell multiple times)
V) ROUND 3 (HR)
– I was asked to rewrite the code for the question that was asked in the written round.
– A few questions about my internships, projects and interests.
– Why did you choose Computer Science?
– If you wouldn’t be studying computers, what would you be doing in your life?
– What are your weaknesses?
– Why do you want this internship?
– Put forth your views on any latest technology and cite a few of its applications? (I talked about AI)
– Apart from the fields where AI is already being used, where else do you think application of AI could be really helpful?
At the end of the entire process, around 16 people were offered summer internship and I was lucky to
be one of them.