Microsoft Interview Questions
- 2of 2 votes
AnswersYou have two very large numbers that cannot be stored in any available datatypes. How would you multiply them?
- confused_coder August 08, 2016 in United States
How would you multiply more than two numbers?| Report Duplicate | Flag | PURGE
Microsoft SDE-2 - 0of 0 votes
AnswersHow will you implement a dictionary.
- Nascent August 08, 2016 in India| Report Duplicate | Flag | PURGE
Microsoft SDE-2 - 0of 0 votes
AnswerDesign a monitoring system for hotel booking site. Proper oops design.
- Nascent August 08, 2016 in India| Report Duplicate | Flag | PURGE
Microsoft SDE-2 - 0of 0 votes
AnswersHow do I solve this simple geometrical programming problem?
- axaysd July 30, 2016 in United States
https://s32.postimg.org/sm75dimol/hurdle1.jpg| Report Duplicate | Flag | PURGE
Microsoft SDE1 - 0of 0 votes
AnswersGiven an array: 1,2,3 ,5,8,7,6,9,5,7,3,0,5
- sindhu1690 July 27, 2016 in United States
subarry:5,7
Find the subarray in the large array and return the minimum length and index where you can find the subarray. Note: that the subarray may be present in the large array non-contiguous.
In the above case : the answer is length = 2 and
index = 8| Report Duplicate | Flag | PURGE
Microsoft Software Developer Algorithm - 0of 0 votes
AnswersSuppose you have a matrix in the form of a 2 dimensional array. Write a method to read the rows of the matrix alternatively from right to left, left to right so on and return them as a 1 dimensional array.
- MM July 15, 2016 in United States
for eg:
1 2 3
4 5 6
7 8 9
should return 1 2 3 6 5 4 7 8 9| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
Answershow to restrict creation of object inside the function fun
- jkl June 19, 2016 in India
although destructor and constructor is private??
#include <iostream>
class ABC
{
private :
~ABC()
{
}
ABC()
{
std::cout <<"ABC";
}
public:
static void fun()
{
ABC t;
}
};
int main()
{
ABC::fun();
}| Report Duplicate | Flag | PURGE
Microsoft abc - -2of 2 votes
AnswersGiven a matrix which is spirally sorted. Remove an element and insert another element maintaining the sorted order.
- neer.1304 June 14, 2016 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswersGiven two sets of strings A and B. Find the
- neer.1304 June 14, 2016 in United States
(A-B) U (B-A) ( U = union ). The answer should be in lexicographical order and A’s elements should appear before B’s.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswerGiven a few points in first quadrant – (x1,y1) …..(xn,yn) and given another set of points (a1,b1…..an,bn), determine whether all the points (a1,b1…an,bn) have already occured in (x1,y1)…..xn,yn)
- neer.1304 June 14, 2016 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswersGiven a graph where every two nodes are either friends or enemies with each other. Find a way to go from one node to the other.
- neer.1304 June 14, 2016 in United States
Restrictions:
1) You can also travel from one node to next if they are friends with each other
2) You have some “magic potions”. You can convert an enemy path to a friend path with a magic potion.
Find the path with min number of magic potions required.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswersYou are given a structure msg
- neer.1304 May 24, 2016 in United States
struct msg
{
long timestamp;
double price;
string label;
};
The msg represents price of a stock on a given timestamp.
Create a class with two functions -
addStockPrice(msg m) -> Used to add Stock Price in Data structure
getAvgPriceForAStockLast10Minutes(String stockName) -> Get average price of a stock for last 10 minutes.
The program should be time and space optimized.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswersDesign and Implement: Producers and Consumer Problem. Producers produce different kind of messages and Consumers register themselves for different kind of messages. Need to design and implement Producer, Consumer and a Delegator which is responsible for storing and delivering the messages to appropriate listeners.
- neer.1304 May 12, 2016 in United States
Changed the question to handle millions of messages.
Changed the question to handle different priority messages.
Threading model for Producer, Listener and Delegator.
In the end he asked me to code 2 methods of Delegator.
1: which adds the message from Producer to its internal queue.
2: Delegate, which delivers the message to appropriate listener.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Software Design - 1of 1 vote
AnswersThis is a question I received in an online challenge.
- sparked12345 April 22, 2016 in United States
A list of numbers are given. We need to find the total number of groups in which the digits of each number have same frequency.
For example if numbers are:
1
10
3
33
There are 4 groups:
G1={1}has one 1.
G2={3} has one 3.
G3={10}has one 1 and one 0.
G4={33}as two 3s.| Report Duplicate | Flag | PURGE
Microsoft SDE1 Algorithm - 0of 0 votes
AnswersFind out if there is cycle in Directed graph
- pc April 09, 2016 in United States| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer Algorithm Data Structures - -1of 1 vote
AnswersGiven billions of Rectangle, find rectangle with minimum area overlapping to a given point P(x,y)
- pc April 09, 2016 in United States
There is a simple way to achieve answer in O(n) by processing each rectangle sequentially, but optimize it further provided large number of Rectangle array.| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer Algorithm Data Structures - -1of 1 vote
AnswersGiven a circular array of images, in LandScape and Portrait mode. Bidirectional movement in array is allowed.
- rajnikant12345 March 13, 2016 in India for Office
e.g.
LPPPLPPP
L-> Landscape
P-> Portrait
Cost of Viewing a Portrait image is Vp
Cost of Viewing a Landscape is (Rp(rotate) + Vp).
Cost of movement is -> m
once you visited the image viewing cost is zero if you revisit the image. Only movement cost is considered.
Jumps in array is not allowed.
Calculate the maximum number of images you can see with cost X.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 3of 3 votes
AnswersGiven a string e.g. ABCDAABCD. Shuffle he string so that no two smilar letters together.
- rajnikant12345 March 13, 2016 in India for Office
E.g. AABC can be shuffled as ABAC.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 String Manipulation - 0of 0 votes
AnswersGiven a DNA sequence e.g. AAAGTAAGTAAGTGGG.....
- rajnikant12345 March 13, 2016 in India for Office
Find all the duplicates with length 10.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 String Manipulation - 1of 1 vote
Answerswhat is the best sorting algorithm in terms of complexity and why?
- Rajesh Burla March 11, 2016 in India| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer Algorithm - 0of 0 votes
AnswersCircular Queue - what it is ? and write a program for this
- its3707 February 18, 2016 in India| Report Duplicate | Flag | PURGE
Microsoft SDET Algorithm - 0of 0 votes
AnswersCircular Queue - what it is ? and write a program for this
- its3707 February 18, 2016 in India| Report Duplicate | Flag | PURGE
Microsoft SDET Algorithm - -2of 2 votes
AnswersI have an array of integer. That provides data to one of the UI screen. That UI screen can show at a time only one data. For each iteration on the array 3 elements get picked up however only the highest number out of those usually shows up on the UI.
- its3707 February 18, 2016 in India
{1,4,5,2,3,4,5,6} means if 1,4,5 picked up only 5 will be shown up on the UI
in next iteration 4,5,2, should be picked up.
next iteration 5,2,3
write a solution for this.| Report Duplicate | Flag | PURGE
Microsoft SDET Algorithm - -2of 2 votes
AnswersI have an array of integer. That provides data to one of the UI screen. That UI screen can show at a time only one data. For each iteration on the array 3 elements get picked up however only the highest number out of those usually shows up on the UI.
- its3707 February 18, 2016 in India
{1,4,5,2,3,4,5,6} means if 1,4,5 picked up only 5 will be shown up on the UI
in next iteration 4,5,2, should be picked up.
next iteration 5,2,3
write a solution for this.| Report Duplicate | Flag | PURGE
Microsoft SDET Algorithm - 1of 1 vote
AnswersIf you have 1TB of unsorted long integers but 1GB of memory, devise an algorithm to efficiently sort the integers. What is the time complexity? What is the space complexity?
- popeye123 January 29, 2016 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer - 0of 0 votes
AnswersGeneric Question: You have a list of items that's nearly sorted. What algorithm would you use to completely sort it? Even though it's already sorted, the least element could be at the other end ...eg: 4,5,6,7,8,9,10,11,1
- Engineer1111 January 24, 2016 in United States
She then said that what would be the approach if the data was not like that, as in , not so extreme.| Report Duplicate | Flag | PURGE
Microsoft Dev Lead Algorithm - 0of 0 votes
AnswersGiven a string that represents an integer with no upper bound (billions, trillions, etc..), write a function "convert" that returns the integer value of the string. For example: "1000322" returns 1000322.Try to do this in O(1) space, and O(n) time. Better if possible.
- william.brandon.lee83 January 18, 2016 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-3 Algorithm - 0of 0 votes
AnswersGiven a binary tree, write a function LCA that returns the least common ancestor of two nodes. This is not a BST. Try not to use parent pointers in the custom Node class.
- william.brandon.lee83 January 18, 2016 in United States
Iterative solution takes O(1) space, recursive solution takes O(n) space.| Report Duplicate | Flag | PURGE
Microsoft SDE-3 - 0of 0 votes
AnswersGiven a list of IP address correspondences, such as
- william.brandon.lee83 January 18, 2016 in United States
IP1 = IP2
IP3 = IP4
IP3 = IP2
IP5 = IP6
IP7 = IP8
etc.
Return a list of unique IP addresses. In this case
IP1, IP5, IP7
Consider IPs as Strings or any other data type.| Report Duplicate | Flag | PURGE
Microsoft SDE-3 Algorithm - 0of 0 votes
AnswersGiven a list of integers (array or list), write a function that returns true if the list can be split into two lists that have an equal sum.
- william.brandon.lee83 January 18, 2016 in United States
Example: {4,2,2,0,-1, 1} returns true
{4}, {2,2,0,-1,1}
and {3,3,1} returns false.
Hints by interviewer:
- Complexity is 2^n| Report Duplicate | Flag | PURGE
Microsoft SDE-3 Algorithm
Open Chat in New Window