Microsoft Corporation
Proud winner of ABECA 2024 - AmbitionBox Employee Choice Awards
Filter interviews by
I applied via Campus Placement
I applied via Referral
Find A-B of two sorted arrays A and B in O(m+n) time complexity.
Create two pointers, one for each array, and compare the elements at those pointers.
If the element in A is smaller, add it to the result array and move the A pointer forward.
If the element in B is smaller, move the B pointer forward.
Repeat until one of the pointers reaches the end of its array.
Add any remaining elements in A to the result array.
Time comple...
The routine should output the elements of the inorder traversal of a binary tree one by one in each call.
Implement an inorder traversal algorithm recursively
Use a global variable or pass a reference to keep track of the current element
Call the routine repeatedly to get the next element in each call
Program to find minimum semesters required to complete courses with prerequisites
Create a graph with courses as nodes and prerequisites as edges
Use topological sorting to find the order of courses to be taken
Calculate the minimum number of semesters based on the order obtained
Handle cases where there are cycles in the graph
What people are saying about Microsoft Corporation
Microsoft Corporation interview questions for designations
Get interview-ready with Top Microsoft Corporation Interview Questions
Find the nth element in a tribonacci series.
Use recursion to solve the problem.
Handle base cases for n=0, n=1, and n=2.
For n>2, use the formula t(n)=t(n-1)+t(n-2)+t(n-3).
Return the value of t(n) for the given n.
Given three sides of a triangle, determine its nature.
Check if any two sides are equal to determine if it's isosceles
Check if all three sides are equal to determine if it's equilateral
Use Pythagoras theorem to check if it's right angled
If none of the above, it's a scalene triangle
I have used Microsoft Office, Windows OS, Visual Studio, and Azure. I want to join Microsoft because of its innovative culture and impact on the tech industry.
I have used Microsoft Office for word processing, spreadsheet management, and presentation creation.
I have used Windows OS for personal and professional use.
I have used Visual Studio for software development.
I have used Azure for cloud computing and hosting.
I wan...
Code a run length encoding algorithm to compress a text string in place.
Use a loop to iterate through the string and count consecutive characters
Create a new string to store the compressed version of the original string
Add the character and its count to the new string
Compare the length of the new string to the original string to determine if compression was successful
Print the leftmost node at the same level as a given node in a binary search tree.
Traverse the tree level by level using BFS
Keep track of the leftmost node at each level
Return the leftmost node at the level of the given node
If the given node is not found, return null
Search for an element in a rotated sorted array in sublinear time.
Use binary search to find the pivot point where the array is rotated.
Determine which half of the array the target element is in.
Perform binary search on the appropriate half of the array to find the target element.
Time complexity is O(log n).
Given an amount and coin denominations, find the smallest no of coins to form the amount.
Use dynamic programming to solve the problem
Create a table to store the minimum number of coins required for each amount
Iterate through the denominations and update the table accordingly
Return the minimum number of coins required for the given amount
Move all distinct elements of an array to the top in any order.
Create a new array to store distinct elements
Loop through the original array and check if element is already in new array
If not, add it to the new array and remove it from the original array
Concatenate the new array with the remaining elements of the original array
There can be multiple such elements in the matrix.
Multiple elements can be max in their row and min in their col
The function should return all such elements
The elements can be in different rows and columns
The question asks to add two numbers represented as linked lists and return the sum as a linked list.
Traverse both linked lists simultaneously, adding the corresponding digits and carrying over the carry.
Create a new linked list to store the sum digits.
Handle cases where one linked list is longer than the other.
Consider cases where the sum has an additional carry digit at the end.
Count the number of times a substring appears in a string.
Use a loop to iterate through the string and check for the substring at each index.
Use the count() method to count the number of occurrences of the substring.
Consider using regular expressions to find all occurrences of the substring.
Handle edge cases such as empty strings or substrings.
The task is to compress a given string by replacing consecutive repeated characters with the character followed by the count of repetitions.
Iterate through the string and keep track of the current character and its count.
If the next character is the same as the current character, increment the count.
If the next character is different, append the current character and its count to the result string.
Return the compressed
Find the leftmost node in the same level as a given node in a binary tree.
Traverse the tree level by level using BFS
For each level, keep track of the leftmost node encountered
Return the leftmost node in the level of the given node
Find the nth largest number in a binary tree
Traverse the tree in-order and store the values in an array
Return the (n-1)th index of the sorted array in descending order
Use a max heap to keep track of the largest n elements
Insert an element into a sorted circular linked list.
Find the correct position to insert the element based on its value
Update the pointers of the previous and next nodes to include the new node
Handle special cases such as inserting at the beginning or end of the list
Example: Inserting 5 into a list with values 1, 3, 4, 6, 7 would result in 1, 3, 4, 5, 6, 7
Prove that given 5 points in a plane, there will be at least two points such that their midpoint is an integer.
Consider the x and y coordinates of the 5 points.
If any two points have the same x and y coordinates, their midpoint will be an integer.
If not, consider the differences between the x and y coordinates of each pair of points.
If any two pairs have differences that are both even or both odd, their midpoints will ...
Use exponentiation by squaring algorithm to find nth power of a number in shortest computational time.
Use recursion to divide the power by 2 and multiply the base accordingly
If power is odd, multiply the base with the result of recursive call
If power is negative, take reciprocal of base and make power positive
Handle edge cases like power=0 and base=0 or 1
Time complexity is O(log n)
The function ring() calculates the number of blocks of both types based on sensor state changes.
Create a variable to keep track of the number of 49 cm blocks
Create another variable to keep track of the number of 50 cm blocks
Initialize both variables to 0
Whenever the sensor changes state, increment the corresponding block variable
Return the count of both block types as an array of strings
The given linked list needs to be inverted in pairs of two nodes.
Iterate through the linked list, swapping every two adjacent nodes.
Keep track of the previous node to update the next pointers correctly.
Handle the edge cases of odd number of nodes or empty list.
Some of the top questions asked at the Microsoft Corporation Software Developer interview -
The duration of Microsoft Corporation Software Developer interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 29 interviews
4 Interview rounds
based on 78 reviews
Rating in categories
Software Engineer
2k
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Software Engineer
1.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Software Engineer2
1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Consultant
599
salaries
| ₹0 L/yr - ₹0 L/yr |
Support Engineer
552
salaries
| ₹0 L/yr - ₹0 L/yr |
Amazon
Deloitte
TCS