# Microsoft Interview Experience | Set 144 (Pool Campus – Internship)

**Online coding Round –****550** students sat for the online coding round and CGPA cut off was 7. Three coding questions were asked to us and we were given 90 minutes to solve three questions.

**Round 1 – Online assessment –**

Platform – cocubes.com

Duration – 90 minutes

Format – 3 Coding Questions

Maximum Score – 10 marks

- Complete the following function –
`int`

`findMax(TreeNode arr[],`

`int`

`size_of_array)`

`{`

`// code goes here`

`}`

`// Where TreeNode is a`

`structure defined as :`

`struct`

`TreeNode {`

`int`

`feet;`

`int`

`inches;`

`};`

The function was supposed to return the maximum value of TreeNode. This was supposed to be done by calculating (12*feet+inches) for each element. It constituted of 2 marks.

- We have been given two sorted linked lists and we had to combine both inked lists such that the combined list is also in sorted but in descending

order, e.g.,

List 1 :- 1 ->3 -> 5 -> 7

List 2 :- 2 -> 4 -> 6

Result :- 7 -> 6 -> 5 -> 4 -> 3 -> 2 -> 1 - We had been given a linked list and we had to segregate its even and odd position nodes in such a way that odd position nodes before even positioned nodes and even positioned nodes had to be appended after odd positioned nodes but in a reverse order. We were not allowed to use any extra space.

Ex – linked list: – 1 -> 2 -> 3 -> 4 -> 5 -> 6

Output: – 1 -> 3-> 5 -> 6 -> 4-> 2.

**10** students were selected for further rounds of interview from our college.

**Group Fly round –** It was a Microsoft pool drive so around 120 students from different colleges came for the pool drive. We were asked 2 programming questions and we were given 45 minutes to

solve those questions.

- We are given three sorted arrays and we had to find three elements from three sorted arrays such that the difference between the maximum and minimum of those three elements should be minimum. All the elements should be from different arrays.

For Example :-

A[] = {1, 4, 10}

B[] = {2, 15, 20}

C[] = {10, 12}

Output: 10 15 10

10 from A, 15 from B and 10 from C

https://www.geeksforgeeks.org/find-three-closest-elements-from-given-three-sorted-arrays/ - We have been given a number which is represented in the from of a linked list and we have to add one to the number and return the modified linked list after addition.

For Example :- num = 123 {1 -> 2 -> 3}

Result :- 124 {1 -> 2 -> 4}

https://www.geeksforgeeks.org/add-1-number-represented-linked-list/

**4** students from our college were selected from the group fly round out of 10 for further technical rounds of interview.

**Technical Interview (Round 1) –**

- He asked about my introduction as he went through my resume and asked me to introduce myself and then shifted on to technical questions.
- We are given the stock market prices of a particular stock for a previous day and we had to find out maximum profit that I could generate by buying and selling a stock on that particular day for only one time. I gave him a O(n) approach to buy and sell the stocks at most one time at a particular date and he was quite satisfied by my approach and then later he asked to ode it and he was very friendly and supportive and helped me in writing the code.

https://www.geeksforgeeks.org/stock-buy-sell/ - He modified the previous question that the stock prices of a particular stock were given for a particular day and we had to buy and sell the stock at most two times on that particular day and we had to find the maximum profit that could be attained by transacting on that particular day. It was a dynamic programming problem and with the help of the interviewer I was able to reach to the O(n) solution. He was quite satisfied by my approach.

https://www.geeksforgeeks.org/maximum-profit-by-buying-and-selling-a-share-at-most-twice/ - He asked at the end do you have any questions for me?

I asked about different roles and teams at Microsoft and the flexibility of changing the teams according to our interests.

Only **1** out of 4 students from our college made it to the second technical interview.

**Technical Interview (Round 2) –**

- The interviewer first of all briefed about himself and told me about his experience about working at Microsoft. He then shifted on to technical Questions.
- He asked that I have been given a binary tree ad I had to find the maximum path sum in that binary tree such that the path starts and ends at the any node in the binary tree. All the nodes of the binary tree are positive. I explained him the approach for solving the problem and then he asked to code it on paper.

https://www.geeksforgeeks.org/find-maximum-path-sum-in-a-binary-tree/ - He asked whether I am comfortable with N-ary tree but I denied and then he asked a bitwise operator problem. You have been given a number and you have to find the next greater number such that it has the same number of set bits as in the given number.

For Example :-

Number = 4 (100)

Result = 8 (1000)

This was a bit tricky question and first I explained him the brute force approach and then he asked me to further optimize it. He helped me in reaching to the solution and in writing the code.

https://www.geeksforgeeks.org/next-higher-number-with-same-number-of-set-bits/ - He asked me in the last whether I had any question for him?

I asked him what should be the future strategy of an intern when he is selected and what should he learn that is beneficial for his professional growth.

Unfortunately I was also rejected after my second technical inter view from my college.

The interview experience was quite good and they focused on all the core computer science subjects. Geeks for geeks was a lot of help to me as it helped me in my placement preparation and provided almost all content that was necessary for placement preparation.