# Microsoft Interview Experience for SDE-1 (Hyderabad)

• Difficulty Level : Hard
• Last Updated : 28 Mar, 2022

I have around 1.5 years of experience and received a call from a recruiter through LinkedIn.

Round 1 (Difficulty Level – Medium): Codility test of 90minutes comprising 3 coding questions.

• First question: Minimum number of parentheses required to make the string a valid parenthesis.
This question is expected to be solved in a single traversal else it gives TLE.
• Second question: Smallest substring occurring only once in a given string
https://www.geeksforgeeks.org/smallest-substring-occurring-only-once-in-a-given-string/
• Third question: Related to matrix and DP, was hard and time-consuming
• Required to solve 50% to reach the next round

Round 2: (Technical Interview Round-1) Difficulty Level – Medium: The interviewer has provided a codility link and asked me to solve a single problem.

• Question: Given a BST, find two incorrectly placed nodes in the tree.
Note – First solve it using a brute force approach and then provide an optimized solution. I solved it using simple inorder traversal and have given the required output.
• The interviewer was very friendly and helped me whenever I got stuck.

Round 3: (Difficulty Level – Hard): The interviewer has given a codility link with two problems and asked me to solve them.

• Second Question: Given 2 cities A and B and given an array of pairs (costA, costB) where costA = cost of moving people to city A and costB = cost of moving people to city B. Write a program to move 2N people into both cities A and B such that N people are in A and N people are in B and the cost is minimum.
Approach: I sorted the array based on the difference in the cost of both cities. Sorting can be done using a comparator interface in Java.

Round 4: (Difficulty Level – Medium): This round was taken by the project manager.

Round 5: (Difficulty Level – Hard): This round was taken by Software Engineering Manager. Provided a codility link with 1 problem to solve

• Question: Given 2 values N, Sprint all combinations of N numbers such that their sum is S.
Example: Input – N=2, S=6
Output : [0,6],[1,5],[2,4],[3,3],[4,2],[5,1],[6,0].
• The problem could have been simple if N = 2, but  N varies and repetitions are allowed and all combinations are allowed. I solved it using a recursion approach where one number is kept constant and started filling other numbers such that sum equals S.

Round 6: AA round (Difficulty Level – Medium): This is the final round called AA (As Appropriate) . The interviewer has given a codility link with 1 problem to solve.

• Question: Given an array of 2N numbers, rearrange the array such that even numbers are in even indexes and odd numbers are in odd indexes. No extra space to be used.
• Solved it using a single traversal, and the interviewer has tested the code against multiple test cases and all corner cases

Suggestion: Primary focus in Microsoft is on problem-solving and system design skills. Practicing LeetCode and Microsoft tagged questions on gfg helps a lot.

My Personal Notes arrow_drop_up
Related Articles