Microsoft Interview Questions
- 0of 0 votes
AnswerYou need to design a new YouTube feature where userA is uploading a video and userB (friend of userA) gets notified for the video and wants to watch the same video in real time (i.e. even the video is not completely uploaded but we want to enable the other user to watch it).
- CoolGuy March 14, 2018 in India
How would you tackle the situation when userB wants to view the content starting from a position which is not yet uploaded.
Draw block diagram for this problem identifying the different components.| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer - -1of 1 vote
AnswersDesign calculator and related class, which returns result of the given expression, e.g if input is (3* 3) + 2 it returns 11.
- CoolGuy March 14, 2018 in United States
Identify different OOPS classes and how would you call them.| Report Duplicate | Flag | PURGE
Microsoft SDE-3 - 1of 1 vote
AnswersA bus has to travel from A to B and the distance is d miles. There are many gas stations between A and B.
- Shilpi_Roy March 12, 2018 in United States
The bus has initially g gallon of gas in tank. 1 gallon of gas travels 1 mile.
Gas stations have inforamtion of remaining distance from station to destination b and max gas that can be filled from the station.
Find the minimum number of stops for bus without running out of gas ever.
eg: gas = 10 , distance = 20
gasStation[] = {{16,3}, {10, 7}, {14, 11},{11, 5}, {7, 6}}
o/p = 1
If bus stops at the stop{14,11} that is 14 miles away from destination and fills 11 gallon then it can reach destination with 1 gallon spare.
It can also stop as {16,3} and {10,7} but its 2 stops and at destination it runs out of gas.
Similarly {11, 5}, {7, 6} has 2 stops but has 1 gallon spare at destination.| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
AnswerWrite a word processor that can do left and right justification for a sample input of string type.
- annu025 March 07, 2018 in United States
Here is an example:
This is a sample.This is a sample.This is a sample.
This is a sample.This is a sample.This is a sample.This is a sample.
Additional details:
* The left margin is 5 units.
* The right margin is 75 units.
* The input string is a single-spaced collection of words and punctuation.
* If the length of the word exceeds the right margin, then we must not break the word. Instead, we must print it on the next line and justify the existing line by adding more spaces to the middle of the line.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer String Manipulation - 0of 0 votes
AnswersGiven a 3x3 tic-tac-toe board with players 1 and 2. Find all the possible ways player 1 can lose given a particular configuration of the board.
- seafan0034 February 26, 2018 in United States
For example (0 denotes empty spot):
input:
0, 1, 0
2, 2, 1
1, 1, 2
Output: 1 (because the only move for player 2 to win would be to play board[0,0])
The input board can have any configuration (player 1 and 2 can be in all possible spots with any number).| Report Duplicate | Flag | PURGE
Microsoft SDE-3 Math & Computation - 0of 0 votes
AnswersDesign a data structure which reads below block of text
- smartbobby2K February 15, 2018 in United States
*Status update1
**Joe is working on a bug
**Alice is on vacation
*StatusUpdate2
**Alex finished task1
and returns me an Object such that I can navigate the this nested text easily like this:
obj.children[0] - > returns "StatusUpdate"
obj.children[0].children[1] -> "Alice is on vacation"| Report Duplicate | Flag | PURGE
Microsoft Software Developer - 0of 0 votes
AnswersGiven a Tree where each node contains an attribute say color(R,G,B... etc). find subtree with maximum number of attributes.
- smartbobby2K February 15, 2018 in United States
Input:
G
/ \
B R
/ \ / \
B B R R
/ \ / \
B R R R
Output:
Input:
R
/ \
R R
\ / \
R R R| Report Duplicate | Flag | PURGE
Microsoft Software Developer Trees and Graphs - -1of 1 vote
AnswersThe best project you have worked till now.
- anonymous December 10, 2017 in India for Office365| Report Duplicate | Flag | PURGE
Microsoft SDE1 Experience - 0of 0 votes
AnswersConvert an Integer to a String.
- anonymous December 10, 2017 in India for Office365
eg 10--->"10",
2.5--->"2.5"
+10--->"+10"
-10----->"-10"
1.25e-7--->0.000000125| Report Duplicate | Flag | PURGE
Microsoft SDE1 Programming Skills - 0of 0 votes
AnswersGiven n line segments, find if any two segments intersect
- anonymous December 10, 2017 in India for Office365
http://www.geeksforgeeks.org/given-a-set-of-line-segments-find-if-any-two-segments-intersect/| Report Duplicate | Flag | PURGE
Microsoft SDE1 Data Structures - 3of 3 votes
AnswersCongrats on aonecode.com member V.S. on the offer from Microsoft and thanks for sharing with us the experience.
- aonecoding December 02, 2017 in United States
Coding Question 1 - Find all the paths between two nodes
Coding question 2 : Max sum in adjacent sub array
Design Question - Design a ticketing System
Design Question 2 - Design a system which allows multiple agents to read different data from same tables. Latency should be low. Algorithm should rank agents through some logic and assigned work according to that so that each agents are reading different set of rows from same table. Scale it for 20 million active agents .
Follow up - If Data Sharding is allowed, what will be the Shard Id and how the partition will look like? How your system will respond if there are agents which are also writing at same time. Consistency should be given high preference over availability.
Looking for coaching on interview prep?
Visit AONECODE.COM for ONE-TO-ONE private lessons by FB, Google and Uber engineers!
Customized course covers
System Design (for candidates of FB, LinkedIn, AMZ, Google & Uber etc)
Algorithms (DP, Greedy, Graph etc. every aspect you need in a coding interview & Clean Coding)
Interview questions sorted by companies
Mock Interviews
Our members got into G, U, FB, Amazon, LinkedIn, MS and other top-tier companies after weeks of training.
Feel free to email us aonecoding@gmail.com with any questions. Thanks!| Report Duplicate | Flag | PURGE
Microsoft Software Engineer Algorithm - 0of 0 votes
Answers3. Complete the following function-
- Rising star November 30, 2017 in India
Node * alternateReverse( Node* head1, Node*head2){
// code goes here
}
Where ‘Node’ is the structure of a linked list node defined as:
struct Node{
int data;
struct Node *next;
};
alternateReverse() must remove the even number nodes from the linked list and append them to the end in reverse order. No extra space was allowed. It was for 5 marks.
Example:
Input-1->2->3->4->5->6
Output-1->3->5->6->4->2
Input-1->2->3->4->5->6->7->8->9
Output-1->3->5->7->9->8->6->4->2| Report Duplicate | Flag | PURGE
Microsoft Software Developer - -2of 2 votes
AnswerWhat is the Big O of that algorithm? What happens at runtime?
- rignanese.leo November 02, 2017 in Europe| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 1of 1 vote
AnswersWhat's the algorithm to transform the sentence "the brown fox ran fast" in "eht nworb xof nar tsaf" (reverse any word)
- rignanese.leo November 02, 2017 in Europe| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 2of 2 votes
AnswersWrite a program to shuffle a deck of card?
- MM October 30, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer - 0of 0 votes
AnswersSuppose you have a stock broker events that send events whenever there is an event occurs, like buy, sell etc.
- MM October 30, 2017 in United States
There are apps that needs gets these data from the events application, not all application needs all the functions.
There is broker interface that is a link between the apps and the stock application. How will you design the classes, methods etc.| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer - 0of 0 votes
AnswersSupposed you have a sorted array, that was rotated like [2 4 6 7 8] => [7 8 2 4 6]. How will find an element in the array.
- MM October 30, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer - 0of 0 votes
AnswerConsider a social networking site, where in each user has a number of contacts, how will you find the shortest path between 2 users who are not connected.
- MM October 30, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft Senior Software Development Engineer - 0of 0 votes
AnswersGiven list of line segments({x_start, y_start}, {x_end, y_end}) find out the maximum number of points they intersect. (interviewer said, he can make it simpler by assuming only vertical or horizontal lines with no overlapping lines)
- bottomcoder October 13, 2017 in United States
Givenen tree in which each node has (or grows) exactly 4 children with values (2, 2.5, 8, 50) plus the value of its parent node. Find out the least K values.
e,g, k = 5, node with value 2, 2.5, 4, 4.5, 6| Report Duplicate | Flag | PURGE
Microsoft Software Engineer - 0of 0 votes
AnswersList of processes with start time, end time and bandwidth. Find the maximum bandwidth for the list.
- bottomcoder October 13, 2017 in United States
2. Given N teams which need to play each other exactly once but at most once in one day, output the game schedule.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer - 0of 0 votes
AnswersSnake and ladder game. Given a board state with position information for snakes and ladders, find the minimum number of ways(aka dice throws) one can reach from start to end.
- bottomcoder October 13, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer - 0of 0 votes
AnswersLongest substring palindrome
- bottomcoder October 13, 2017 in United States
(interview looking for n^2 or less solution)| Report Duplicate | Flag | PURGE
Microsoft Software Engineer - 0of 0 votes
Answerswrite a function to check if a given number is super-prime.
- Ladym October 10, 2017 in Israel
you are given a function that checks if a number is prime.
super-prime is a number that both it's prefix AND suffix are prime number.
The solution has only one loop.| Report Duplicate | Flag | PURGE
Microsoft Junior programmer - 0of 0 votes
AnswersGiven a root to a binary tree, find the level of the tree with the minimum sum.
- Ladym October 10, 2017 in Israel
for example:
50
/ \
6 2
/ \ /
30 80 7
the answer is: level 2| Report Duplicate | Flag | PURGE
Microsoft Junior programmer Trees and Graphs - 0of 0 votes
AnswersDesign a system which helps to calculate average Skype call duration per day. In which events are tracked from mobile app. Need to take care of all edge cases like events can be logged to server in any sequence & there can be some events missing on server side also.
- gauravkumar1491 October 07, 2017 in India| Report Duplicate | Flag | PURGE
Microsoft SDE-2 System Design - 0of 0 votes
AnswersGiven a very large binary number which cannot be stored in a variable, determine the remainder of the decimal equivalent of the binary number when divided by 3. Then generalize to remainder of any number 'k'
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 2of 2 votes
AnswersGiven a pre-order traversal, construct a binary search tree in O(n) time.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswersGiven a large text file, find an efficient algorithm to find the least distance(measured in number of words) between any two given words.
- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 1of 1 vote
AnswersYou are given a text file. You have to return the list of starting index of the given word in text file. Design an efficient DS for that.
- neer.1304 September 01, 2017 in United States
Example :-
Text file content : “geeks for geeks”
word : “geeks”
List : {0,10}| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 0of 0 votes
AnswersIn a file, there are two columns, first column has some word (String) and 2nd column has some value (Double).
- neer.1304 September 01, 2017 in United States
Example :-
ABC 23.4
ERF 34.89
WERT 122.9
Now user wants some arithmetic operations like
1) ABC + ERF = 23.4 + 34.89 = 58.29
2) ABC – WERT = 23.4 – 122.9 = -99.5
Design an efficient DS for these kind of operations.| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm