Education + Jobs Hiring Website - 2025
0 like 0 dislike
21,688 views
in Interview-Experiences by Expert (4,460 points)
retagged by | 21,688 views

40 Answers

1 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.

 Eg.

 

 Input: 10 

 Output: 3

 10->9->3->1

 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]);

    }

    cout<<dp[n]<<endl;

}

Output:

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 (4,460 points)
1 like 0 dislike

Microsoft  | Summer  Internship | ON CAMPUS

 

Round 1 :- Coding Round . 

This round was held on mettl.com There were three questions in a set and different sets for each student.

  1. Problem 1 -  Given the coefficient of a quadratic equation, find the root of the quadratic equation and return the value with at most three precision. Like if answer is 3.0 then return 3.0 itself but if answer is 3.1249 theen return 3.125. Easy question, find discriminant and apply formula.
  2. Problem 2 - Given two lists of 1’s and 0’s. If the first element of both lists is the same then remove it from both lists. If Different than in the first list, pop the first element and append it at last. How many numbers will be left on the list ? This question can be done using stack and queue.

They shortlisted 27 students for a Group Fly Round.

 

Round 2 (Group Fly) Round :- 

  1. Problem 1 :- Find whether the number is lucky or not. 
  2. Problem 2 :- Find whether the tree is binary or not.

We were supposed to write complete code on Paper

 

 Round 3 : Technical Round 1 

First of all, the interviewer asked me about my projects related questions for about 10 minutes.

  1. Problem 1 :- Given a string, find whether it is a valid parentheses. First I gave an approach using a stack then the interviewer asked me to optimize space complexity.
  2. Problem 2 :- I was given two linked lists and multiplied them and stored them in the third linked list. You can only use the new space for the third list and O(1) extra.

 

Round 4 :- Technical Round 2 

1. First question was about connecting nodes at the same level.

2. Given a linked list and an integer m. I need to rotate each m node of the link list. For example if my linked list is 1–>2–>3–>4–>5–>6–>7–>8–>9–>10–>11–>12–>13–>14 and m is 4 then return 4–>3–>2–>1–>8–>7–>6–>5–>12–>11–>10–>9–>14–>13. 

Constraints: Time Complexity O(n). Space Complexity O(1). Node value can not be changed.

 

Round 4:- Technical Round 3

1.There is a single core CPU and this code is running 

     “int main(){

       while(1);

      return 0;

      }” (infinite loop) and if we try to open the notepad will it open ? Give reasons. I explained Round Robin scheduling.

2. Given a maze, define an appropriate data structure to store it. Solve the maze and print the path. I was told to make some assumptions if needed. I assumed a square maze and stored it using two maps. To solve this problem I used a backtracking approach. Then he asked me to write pseudo code.

 

Status : - Selected

by Expert (4,460 points)
1 like 0 dislike

Microsoft  |  Internship | OFF CAMPUS

Microsoft conducted an all India drive for hiring SDE Interns(Minimum CGPA was 7 and no backlogs were allowed). They conducted a coding round in which people who solved 3 got a call or people who solved 2 and had a higher CGPA(+9) also received a call. Girls solving one problem were called for an on site interview.

 

Round 1 :- Coding Round.

  1. Problem 1 - Distribute N candies among K people
  2. Problem 2 - Minimum steps required to convert X to Y where a binary matrix represents the possible conversions.
  3. Problem 3 - Minimum number of sets with numbers less than Y.

 

Round 2 :- 60 min.

  1. Problem 1 -  Find the Lowest Common Ancestor in a Binary Tree.
  2. Problem 2 - Given a matrix, find and print the maximum path sum from 0, 0 to n-1, m-1.

** People solving both the problems and girls solving the first one completely and printing the maximum path sum for the second were taken to the next round. There would be 25 people who made it.

 

Round 3 :- 

It was a personal interview which was taken by two interviewers. They were really nice and gave me a lot of time to discuss. We had a long discussion on the ML projects that I did. They asked me about the algorithms used and the libraries and the functions in depth. They also asked me how I could do the same without functions and other stuff. It went for around 30 minutes. 

The next 15 minutes had a problem discussion in which I was asked to find the K-th largest element in the array. I gave a solution using set since they initially said that it contained unique elements, as soon as they said it has duplicate elements, I switched to priority queue. They later asked me to implement set or priority queue, which I was unable to do. 

After lunch, they informed me that I made it to the third round. Around 10 made it to the next round.

 

Round 4 :- 

The interviewer was of young age and seemed to be nice from the beginning. He asked me initially on my low semester marks, and they gave me an option to choose from DSA or Software Engineering or Architecture, on which I choose DSA. 

He gave me 3 questions during this course which I solved successfully.

1.   Find the minimum element in a rotated sorted array. I solved and coded the same using  binary search, he just asked me to add a case for n==0 which I missed.

2. Sort an array of 0’s and 1’s without sorting and minimum number of lines of code.

3. Detect a loop in the linked list. He just asked the approach and asked me to not write the code.

After that he asked me whether I would be able to answer real life problems using DSA. Then he asked me to implement a dictionary, on which I gave a trie solution, he was impressed with the answer, and asked me about search engine optimizations and DSA application on the search engines while predicting texts in the search box. We had a light chat after this for 2 to 3 minutes, in which he seemed to be impressed.

 

After an hour, they took our CV and selected 4 out of the 10 who were there. I went personally to the recruiter over there to know the reason for the rejection. He asked my name and after cross checking, mentioned that, since everyone was good, they were left with nothing but to choose on CGPA. I sadly had a low CGPA of 7.33 which turned out to be a curse.

 

Status :- Rejected

by Expert (4,460 points)
1 like 0 dislike

Microsoft | ML Internship | ON CAMPUS

30 Jun, 2021

 

Round 1 (Written) :-

62 mq questions in 1 hour. The level of paper was tough. 

Only 7 were shortlisted. The questions were based on Machine learning Algorithms, probability and counting, and statistics. It was conducted on Mettl. If you are able to solve 50% of the problem, then you can expect a call.

 

Round 2 (Technical Interview) :

Focus : Problem solving skills 

Problem 1 :- Based on Trees.

 I was given an input and a binary tree. My task is to delete all leaf nodes whose data is equal to the given input (wait it’s not that simple, you need to implement cascade delete in this question). I told him the approach and it was correct. Then he told me to write the code for it. I tried and reached very close to the result but missed one condition.

Problem 2 :- Few Questions were asked on neural networks, sentimental analysis. He gave me a problem about how to classify flight booking emails from other mails. I gave several ideas and approaches. It was an open-ended question so it totally depends on the interviewer whether he likes your idea or not. 

After this round 1 was over. It lasts for 50 minutes..

 

Round 3 (Face to face interview) :

Focus : Projects and Domain knowledge

He  told me to introduce myself. Then he quickly jumped to my projects section and asked every project one by one in depth. He asked several questions on Neural Network, CNN, Bagging Boosting, decision trees, activation layers. How to prevent overfitting, Regularization etc. How to mix more than one ML Algorithms. How to think, which algo should we apply in any particular scenario. That’s all about the second round. It lasts for 45 min.

 

Status :- REJECTED.

by Expert (4,460 points)
1 like 0 dislike

Microsoft | 2021 |  OFF CAMPUS.

Difficulty Level : Medium  

STATUS: Final Year [2021], B.E. Computer Science and Engineering, Tier-3

 

Timeline [Application -> Interview] 

  1. Applied via Microsoft Careers Portal. (No referral, all credit to ATS-friendly resume design and talent acquisition department).
  2. Received online test link on April 2, 2021
  3. Received Interview Invitation on April 6, 2021.
  4. Interview Communication mentioned 2 technical rounds and 1 AA discussion. Each round is an elimination round and AA discussion happens only if the first two go well.
  5. Completed First round at noon (April 8, 2021). Received an update the same afternoon that they will be jumping to the final round (AA discussion).
  6. AA discussion, initially scheduled for April 9, got rescheduled to April 10 due to the unavailability of the interviewer.

Waiting to hear back!

 

Online Test:- 

90 mins test with 3 questions. 2 easy, 1 medium-hard (got stuck with this one).

  1. First two related to strings and pattern matching (solved).
  2. 3rd related to puzzle solving. [hint: Goat, Grass, Lion] (tried but TLE)

Round 1

The interviewer had some trouble with his system. He informed me humbly. Started after 20 mins.

He introduced himself. Asked me about myself and my work (as it was mentioned in my resume)

Asked to mention any challenges I faced while working on my project.

Shared Link to codility and shared the first question.

Question 1 – Again related to string, anagrams. Discussed optimizing and adding conditions to test the code.

Question 2 – Related to arrays, I used an approach similar to the priority queue approach in this question to solve it.

Was asked to code both the solutions.

Talked a bit more about my work, and then he asked if I had paid any attention to the security part of the website or actually implemented any. I explained what parts I had focused on and implemented on my website.

He repeated them and asked me to explain a specific term.

He asked if I have ever implemented authentication and if my website needs it. I said I had implemented it but only using built-in Django Auth Models.

After all that talk, he asked if I had any questions for him.

I asked, he explained. END

Round 2:- 

Received an Update later during noon that the team had decided to jump to the final round.

AA Discussion:- 

The interviewer introduced himself and asked me to tell a bit about myself.

Asked me to dwell more on information about my internship.

I hadn’t given him any details about the product we were building and started explaining my role. After I finished, he asked me to explain first what kind of problem I was solving there. So (I mocked myself first for not starting by explaining the product) and then explained in detail.

He then asked me “how can you make your website more troubleshooting?” This is the question I struggled most with. Somehow I was not getting what the interviewer meant by that question. I gave him a couple of answers, but they were not accurate.

I admitted that I was not able to understand what he was looking for, and he said, ‘we can move on from this.

After 20 mins of me struggling over the word troubleshooting he shared the codility link.

He shared the question verbally. It was related to the Binary Search Tree. Pretty Simple.

I discussed a few approaches, and he asked me to go ahead with the coding.

I coded the whole solution. Modular and Structured.

He asked me to run it. I got 3-4 errors. Silly mistakes like forgetting to pass variables in method calls. He didn’t seem to care as I got hold of them in a second.

He seemed satisfied and asked if I had any questions for him. I did.

He asked me about how I got into this interview loop i.e, the process I followed until this AA round.

Then he asked me about my university and how I compare as a student to other students at my university.

 

Feedback from Interviewer

After all this, he gave me some feedback and mentioned I had very good coding skills. He appreciated that the code was structured and modular.

He pointed out that he asked me an ambiguous question (about troubleshooting) just to see how I handle it and I got a little agitated at the point when I was unable to answer it.

He suggested that I should be more calm and open in situations like this.

I agreed and said something in acknowledgment. He continued and said that the company looks for candidates who can handle ambiguous situations but at the same time they also look for people who don’t give up easily which he said was reflected by later part of our conversation, (conversation about my university projects).

We summed up.

 

Result :- Selected 

 

Some Points To Remember :- 

Don’t stress yourself if your interviews get rescheduled or your interviewers join late for the meeting. These interviewers are generally seniors whose schedules remain rather busy.

Hope this helps. All the best!

by Expert (4,460 points)
1 like 0 dislike

Microsoft | 2021 | Off-CAMPUS | Microsoft engage program

 

Round1 ( Coding Round on Codility ):

There were two questions to be solved in 120 mins. Questions were medium-hard level.

  1. This question was based on multi-source BFS. A graph was given and an array of hospitals, now for all non – hospital nodes, we need to find the max time an ambulance may take to reach them. ( medium-hard )
  2. This question was based on Graph DFS + DP. Don’t remember the question exactly, but it was to apply the inclusion-exclusion principle on graph nodes using DFS. ( hard )

I was able to solve both the questions and passed all the given test cases within 60 mins. It was mentioned that code would be judged after submission for hidden test cases as well.

 

Round 2 ( Interview Round 1 on Teams ):

This round lasted for about 45 mins. I was asked 2 coding problems.

  1. Zero Subarray sum, earlier he asked for a bool value, then he asked me to return starting and ending indices of all such subarrays.
  2. When a binary tree is given, the node value can be either 0 or 1. Now moving from root to a leaf forms a decimal number in binary representation. I was asked to find the sum of all such possible decimal numbers. All such possible numbers would be equal to the number of leaf nodes present in the binary tree.

I was able to solve the first one quickly, then the second one with some hints from the interviewer. I was asked to write code in my favorite editor and run the code for some test cases. The interviewer was satisfied at the end and he asked whether I had any questions for him. Within half an hour I received the call for my second round.

 

Round 3 ( Interview Round 2 on Teams ):

This round lasted for about 50 mins. I was asked 2 coding problems.

  1. Cutting a rod problem was asked, I explained the overlapping subproblems first and optimized them using DP. I was asked to run the code and check for many test cases( including the edge cases ). The interviewer was satisfied with the code, then he said we have time so let’s solve another question.
  2. String question DP + Rabin Karp Hashing. Given a vector of strings, and a target string, find whether a subset of the array of strings could concatenate to the target string, if more than one possible way, return the one with minimum elements in the subset. I explained to him first how hashing would help in comparing then overlapping subproblems while making the target string. Then I was asked to write the code for the same.

The interviewer looked happy after I solved both the questions, So I was pretty sure that I would qualify for the next round.

 

Round 4 ( Interview Round 3 on Teams ):

This round was conducted after 4 days of the previous two rounds.

The interview began with my introduction, I was asked to brief about my internship and project experience. Then he asked me the potential problems that would occur if my project ( web dev ) was used by millions of users. It took the direction of system design, we discussed how to decrease the latency time in detail.

Then after a 20 min discussion, he asked me a coding problem to code quickly. The problem was based on a string. A string is valid if all the characters have the same frequency or at most two different frequencies. Example – aabb is valid, aabbccdd is valid, aabbccdd is also valid, but aabcddd is not valid. The question was pretty simple, but it took time for me to understand it. I wrote the code and then the interviewer asked me to run it on some test cases.

 

 Result: In the evening on the same day, I got the mail that I have been selected. I was so happy and started celebrating.

 

Tips for Coding Round –

Practice Graph-based questions and their variations. Try to write print/cout statements along with your code, this helps you to debug faster.

Try commenting on your code as well and with meaningful function names.

Make sure to check for edge cases ( very imp ).

 

Tips for Interviews –

Listen to the question carefully and clarify the question first, before prompting for your solution.

If you are stuck, discuss what you know and where you are facing issues, this helps the interviewer to provide a direct hint.

After you discuss your approach, don’t forget to explain the time and space complexities.

Be confident in your answers and think out loud.

I hope this helps !!

by Expert (4,460 points)
1 like 0 dislike

Microsoft  | ONCAMPUS | Sept, 2020

 

Round 1 (Coding Round):

In this round, 3 coding questions were to be solved within a period of 90 minutes. It was held on the Mettl platform. This round was quite easy and I had completed it within 20 minutes.

  1. Given an integer, find the total number of set bits, first and the last set bit. 
  2. Given a string, find out the longest palindromic subsequence.
  3. Given an array of integers, find the number of inversions in the array. The expected time complexity is O(n2).

After the coding round, there were 3 rounds of interviews.

 

Round 2 (Technical Interview):

This round went about for nearly 50 minutes and it was quite smooth. The first question asked by the interviewer was based on my projects, experiences, and my current work in the ongoing internships. After this, one coding question based on a binary search was asked.

  • Given a sorted array pivoted (rotated by some number) at some point, find the position of a given element. 

I gave a brute force O(n) approach straight away and made it clear that I was thinking of an optimized solution. Later, I explained the O(log n) solution using binary search and was asked to write the code for the same. He found something peculiar in my code and I had to prove myself through a test case. Cross questioning on the written code was followed by a question to dry run the code on test cases where my code might fail. I suggested a test case and it failed. Finally, I made the corrections and the interviewer was quite satisfied. This round went pretty well.

 

Round 3 (Technical Interview):

 This round went for nearly 1 hour and 20 minutes. It wasn’t as smooth as the previous 2 rounds and I guess most of the filtering of candidates took place in this round. I was tested on my analytical, coding, and problem-solving skills in this round.

Why was I interested in machine learning and deep learning (which is my area of interest) and not my core branch subjects? 

Then, 3 output questions were asked, one of them was based on pointers, another was based on recursion and storage classes. I don’t remember the 3rd one.

The next set of questions were based on LRU cache. Define the LRU cache and what data structure would you use to implement it? My first approach was using queue but later on, I felt vectorized implementation along with hashing would work. I was questioned about its space and time complexity and was also asked to further optimize the space complexity. I gave a solution with optimized space complexity at the cost of time complexity. He seemed satisfied with the solutions. Then, I was asked about a real-life example of LRU cache. I couldn’t think of an example at that time.

Questions based on locked transactions in the banking sector. What will happen if 2 transactions are being made from the same account exactly at the same time? What are the different checks made by the bank to keep a check on frauds? I suggested some methods based on analytical thinking and observations from my daily life. 

How is a URL shortened? 

Given an array of integers what will be the maximum OR value? Find the smallest subset that gives the maximum OR value. I solved this using dynamic programming.

Given a BST, find the distance between 2 nodes whose values are given. I explained the DFS approach for this by taking one element as the root. 

 

Round 4(Technical + HR Interview):

This round lasted for about 45 minutes. Questions in this round were based on the following topics:

  1. Operating Systems
  2. Data Structures and Algorithms
  3. Machine Learning and Deep Learning 
  4. Project-based questions
  5. Networking
  6. System Design
  7. HR questions

My advice to all the candidates who are going to appear for an interview in the coming weeks or months is to stay calm and confident during the entire process. You can deliver your best only when you are calm and composed. According to me, the companies not only test you on your technical knowledge but also on how you interact during the interview and handle difficult situations. Students generally focus on OOPs, DS/Algo, but I think preparing on topics like Operating Systems, Networking, and System Design will be really helpful in the interview process.  

The master tip to each and every aspirant is to keep interacting with the interviewer, think aloud so that the interviewer gets to know your approach. 

by Expert (4,460 points)
1 like 0 dislike

Microsoft | OFF CAMPUS | December, 2021

 

Round 1(Coding Round):2 questions to be solved within 60 minutes.

  1. Invert a binary tree.
  2. Lexicographically smallest string formed by removing at most one character

Round 2(Technical Interview 1): Taken by a Software Engineer with around 2-3 years experience. 

  1. All 4 pillars of OOPS
  2. Difference between Linked List and Arrays
  3. Reverse a Linked List
  4. Difference between Queue and Priority Queue
  5. Given a few tables which have some values linking a few rows across tables, write a functional code to print the entry with highest priority. (Main focus here was on creating classes with modular and well defined structures, usage of correct data structures at right point [HashMap, ArrayList, PriorityQueue] and clean coding)

Round 3(Technical Interview 2): Taken by a Software Engineer with 5+ years of experience.

  1. Add two binary strings that have been represented using Linked Lists.
  2. Search for a word. (Trie based approach. Only asked for approach, did not ask to code)
  3. Discussion on Multi-Threading, Mutual Exclusion, Design Patterns in Java, Inheritance vs Interfaces, Synchronization, Producer-Consumer problem

Round 4(Manager Round): Taken by an Engineering  Manager with 20+ years of experience. After a quick introduction about myself, I was asked about          

  1. Discussion about current projects and tech stack
  2. Check whether a given parentheses expression is balanced or not
  3. Length of the longest substring in a string without repeating characters.

Tips:

  1. Focus on basics. DSA, OOPS, OS
  2. Show willingness and eagerness to learn and collaborate in technical interviews.
  3. Don’t lose faith and trust your preparation. I had previously been rejected by multiple product-based companies during campus placement and also during my off-campus attempts.
  4. Maintain a good connection with your assigned recruiter/HR. This shows an eagerness from your side and he/she can really guide you through the ins and outs of the process very well.
  5. Above all, believe in yourself.
by Expert (4,460 points)
1 like 0 dislike

Microsoft  | Off-CAMPUS.

2022, January

I got this opportunity through the Microsoft engage program 2022.

After the coding assessment, you will be assigned a mentor where you will have to show your work case in a period of 3 weeks. If you do not perform well during the mentorship program, you may not be called for the interviews.

 

Rounds:

  1. 1 round on CV selection
  2. 1 coding round
  3. 3 weeks mentorship program (similar to an internship), and based on your performance in the mentorship, there would be interview rounds (normal – 3 Technical rounds). Lucky me, I got a direct interview call after the coding round. All rounds (including interviews) were conducted on the Codility platform.

 

Coding Round (90 minutes): 

Two questions were there ranging between medium-hard types. I solved both of them within 40 minutes

Q1) Problem very similar to this one: https://codeforces.com/problemset/problem/1027/F

Concept: Use DSU or Graph.

Q2) Given N points (can be collinear) in the 2D plane. We are required to find 3 points such that the triangle formed by choosing these 3 points should not contain any other points inside the triangle.

Concept: You have to find the 3 closest points. Consider any point as a 1st point, then find the 2nd one which is closest to it using the DISTANCE FORMULA. Now you have 2 points, find the 3rd one which is closest to both of them (using the same concept), and also keep in mind that points should not be collinear (you can easily do this by checking that the slope of points 1 and 3 should not be equal to the slope of points 2 and 3).

 

Technical Round 1(based on DSA – 1 hr)

The round was completed in 20 minutes only

Find the cousins in a binary tree

 

Technical Round 2(DSA round – 1 hr): 

Took me almost 1 hour to write the full working code 

Find the next permutation

Find words in the matrix (for harder version, use Trie):

Word Search 1 Problem

Word Search 2 Problem 

 

Technical Round 3(Project and DSA round – 1 hr):

 40 – 45 minutes for the project and rest for the coding problem

Detailed discussion on any one of the projects: Stacks and techs used, why you made this app, the problem faced, how did you manage to make your app efficient, database structure and schemas, functional and non-functional requirements, security, scalability, etc.

1 Problem :- Prefix with Equivalent Frequencies.

Note: Even if you are not able to write the complete and working code, show your approach. They tell you to write the code to see if you are able to write what you think.

Be positive and aloud during interviews. Don’t be nervous and in a rush to answer the question. Take your time. Interviewers will help you whenever you will get stuck. Believe in yourself and always in God.

by Expert (4,460 points)
1 like 0 dislike

Microsoft | SDE-I (On-Campus)

21 December 2021

Online Assessment  – There were 2 coding questions.

Q1) There are N cities. Cities are connected by roads .(Basically given a graph). K of the cities has a hospital(Given an array of size K). Time taken to reach a hospital from a city is no of edges to the nearest city which contains a hospital. Find the maximum time taken to reach a hospital from all the N cities. 

Ans – (Just do a normal multi-point BFS and store the distance of every city and return the maximum one).

 

Q2) Given a tree of N nodes(0 as the root). Each node contains either ‘A’ or ‘B’. Return the longest path of the tree such that no consecutive letter of that path is the same.(Either “ABABA..” OR “BABABA”) .  

Ans – Pretty standard DFS question . Calculate the answer for each node as a root (sum of 2 best child subtree+1) and return the longest path (longest child subtree+1). Maximize the answer.

Luckily, Microsoft gave weightage to the time in which candidates solved the questions, rather than the gpa unlike some other companies. Around 40 were shortlisted for interviews.

 

Interview Round 1 – 

He introduced himself and asked me for an introduction and 1 of my project(mine was an e-commerce website) and asked some questions about it. (Ex-How would you handle multiple requests at the same time for the e-commerce website. How much load can your website take .)We had a discussion for around 20mins and then he asked me a coding question.

 

Given a 2D grid, there is a value present in each grid. 1 means this index is vaccinated . 0 means this index is not affected till now but not vaccinated .  -1 means this index is affected by the virus.  (Virus will spread from -1 to 0, in 4 directions) .Find the last day when virus spreading will stop.

I gave him the solution by multipoint bfs. He was quite satisfied with it and asked me to code it. After that he asked me some questions like count the number of indices which are not going to be affected at all(but not by this approach. I gave him the approach of doing a dfs from each indices having 0 value and if we find a 1 we will just return but if we find a -1 this index is surely going to be affected at some time. He was satisfied with it.)

Then he asked me to write some good  test cases for the original question , so that it will cover all the possibilities of the solution. At the end he was satisfied and asked me to wait in the call for next round.

 

Interview Round 2

After the introduction, he asked me about my internship experience and what work i have done there, the tech stack I have worked on. 

Then he asked me some oops concept (polymorphism, abstract classes).

After some time of discussion, he gave me a coding question. https://www.geeksforgeeks.org/find-pair-given-sum-bst/

But I had to code for the input as well(the whole bst and how i will take the input) and find all the pairs. He was satisfied with my code and asked me to stay on the call for next round.

 

Interview Round 3 – It was an HR round. 

He asked me different questions about my internship and what challenges I have faced during that. Why I want to join Microsoft and what I have to offer to the company and some other HR questions. 

Then he talked about the goal of Microsoft as a company and what is the work culture there etc. This round lasted around 35mins and my interview was done.

Verdict- Next day I got to know that I was selected for the role. 

 

Tips:

For the preparation point of view, my advice would be study all the CS fundamentals(oops, OS, DBMS, CN), practice as much as u can in GFG and Leetcode, know all of your project (like what technologies you have used and why you chose that). 

Also, some of my friends were asked System Design questions. So you should be prepared for that as well( e-commerce design, twitter design, lift design, parking lot design etc. ). 

Happy Coding!!

by Expert (4,460 points)