# Microsoft Interview experience | Set 119 (For Internship)

Microsoft visits our campus every year as a part of the intern hiring program in the Day 1 slot. The procedure consists for three major steps-

• Online Coding Round
• Written Coding Round
• Interviews

Now, moving up the ladder in sequential steps-
Note:I am writing just the questions such that you literally visualize yourself into this interview. I will be discussing the answers if there arises a demand for so.

• 1st Coding Round
• It was an online coding round with 3 questions and hosted on cocubes.com. Just a matter of fact, everyone got a different set of three questions, better run-time and space complexity was awarded higher marks.
The set of three questions for me was –

• Given n and m, find the nearest number to n which is divisible by m. If there exist two numbers at same distance, output the greater one.
• Given an integer n, if the binary representatino of this number is a palindrome, then find the number of ones. You are required to accomplish the task without using any data structure.
• Given a binary tree, find the length of the smallest path from the root to a leaf node with a given sum, in constant space.

A lot of students were shortlisted from this round as doing all the three questions wasn’t too tough here.

• 2nd Coding Round
• It was an offline written coding round with 2 questions. Do write clean and correct codes, with appropriate names for variables and proper indentation.
The questions were –

• Given a string as “Being in an IIT worths a lot”, convert it to “lot a worths IIT an in Being”. Don’t use string library functions.
• Given an array of integers, find the subsrray with the maximum product.

35 students were shortlisted from this round. An alert to be ready for surprises – the selection procedure wasn’t transparent enough for you to be confident in getting an entry to the next round. What I mean to say is, many among those who were shortlisted did it Wrong, and many others who did everthing fine weren’t granted an entry.

• Interviews
• I went through three rounds of interviews with different persons, with around 2 questions in each round. The third round also had a discussion over my projects.

The standard ones –

• Join all nodes at same level in a binary tree. Do this iteratively with constant extra space.
• Find whether u and v are connected in a directed graph, if yes, print the path.

A bit interesting than those above-

• Do the first question of the written coding round without using ANY extra space, in O(length of string).
It’s intersting just bcoz it’s something different.
• How would you implement a LRU cache?

Apart from these things, they also considerd the CGPA for the final shortlisting.

This article is contributed by Shivam Dubey. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.