Microsoft Interview Questions
- 0of 0 votes
AnswersWrite pseudo code for Optimal game stratagy:
- sse July 05, 2012 in United States
You have X amount with you, and 2N cards (N - winning cards, and N-loosing cards).
you have to play all the cards.
all cards are well shuffled, and one card is drawn randomly for each time.
if you pic one card means, next time you have to take one card from rest of the cards, i.e at last of the game you will left with one card.
If you bet 100 rupees,
If you got winning card ===> then you will get 200 rupees,
If you got a loosing card ====> then you will loose all your betting amount.i.e 100 rupees in this case.
You need to play all the cards. (I solved it.)
He asked me to solve it, with card replacement, i.e every time one card is drawn from 2N CARDS.| Report Duplicate | Flag | PURGE
Microsoft Developer Program Engineer Algorithm - 0of 0 votes
Answersn numbers (both +ve and -ve) are arranged in a circle. find the maximum sum of consecutive nos. Do this in O(n) time
- codez July 03, 2012 in United States
E.g.: {8,-8,9,-9,10,-11,12}
max = 22 (12 + 8 - 8 + 9 - 9 + 10)| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersReverse a linked list
- devsri July 03, 2012 in India for STB| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswersThere are four couples on one side of the river. There is an island in between that can hold only two people at a time. There is a boat that can carry maximum of two people. You need to transfer all 8 of them to the other side of the river. Condition is that a wife can not stay in the absence of her husband if any other male is present. She can stay with other females but not with other males in the absence of her husband.
- devsri July 03, 2012 in India for STB| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
AnswersDesign and code a heap memory manager
- devsri July 03, 2012 in India for STB| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer - 0of 0 votes
Answerssublist of a sorted (ascending order)link list is reversed...
- pankaj.ani2000 July 02, 2012 in India
correct it
1--->2--->3--->4--->8--->7--->6--->5--->9--->10--->NULL| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersConsider you have a grid of size m x n. There are stones placed randomly in some of the squares of this grid. Design a way to find out minimum rectangular area which covers all the stones in this grid.
- bobbysanders007 July 01, 2012 in United States| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersA) Write a function that takes input as integer and converts it into a linked list where each node represents a digit of the input integer.
- bobbysanders007 July 01, 2012 in United States
e.g. i/p : 123
expected result: [1] => [2] => [3] => [null]
(catch: don't forget to consider case of negatives like -433 etc.)
B) Write a function that takes input as two linked lists shown as above (which are basically integers represented in linked list format) and calculate sum.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test Algorithm - 0of 0 votes
AnswersWAP to delete all the nodes from given BST.
- gdb June 30, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
AnswersWAP to return numbered index if input is excel sheet column header name.
- gdb June 30, 2012 in India
e.g
excel sheet column headers are A, B, C , D ... Z, AA, AB...AZ, BA,, etc
if Input is D , output should be 4
and for AA output should be 27| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
AnswersWAP to delete all the nodes from given BST.
- gdb June 30, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft - 0of 0 votes
AnswersWAP to return all anagrams from the array of strings.
- gdb June 30, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Algorithm - 0of 0 votes
AnswersGiven an array which is alternatively sorted. Find an element in it.
- Aashish June 30, 2012 in India
e.g. 12,2,16,5,18,32,33,38| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswerExplain the time complexity of external merge sort where each array has N elements & there are exactly N arrays.
- Aashish June 29, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven an unsorted array of size 5.
- Aashish June 28, 2012 in India
How many minimum comparisons are needed to find the median?| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersWhat is the difference between the two declarations?
- Aashish June 28, 2012 in India
int p=*(int*)i;
int p=*(int*)&i;| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
Answersgiven 3 arrays, array a, array b, array c.
- sb June 28, 2012 in India
find all pairs where a[i] + b[j] = c[k]
a, b , c are sorted.| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Arrays - 0of 0 votes
Answersdesign a data structure to send a snapshot of a chess board at any time in between the game
- infactdoit June 26, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersIn a tournament with N teams, where in one team can play only one match per day, develop an algo which schedules the matches in the tournament.
- infactdoit June 26, 2012 in India
Each team shall play with the other team once(same as designing the league matches of a Cricket tournament like IPL)
He also asked me to optimise on days| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersIf i type some numbers in my cell, all phone numbers which have these typed nos in any order should appear, tell data structure for this.
- Aashish June 25, 2012 in United States
eg:if i type 926 then
932678....
92678...
9777726....
should appear.
[EDIT]: It seems you have lot of confusion.
Let me clear it through another example
eg: i enter 321, then
o/p(if they r in book)
9344241..
972153....| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Data Structures - 0of 0 votes
AnswersThere are 9 identical Maples out of which 1 is heavy. find that maple.
- jaks June 23, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Brain Teasers - 0of 0 votes
AnswersGiven a set of data ranges (i.e. 2-7, 5-9, 10-20), write a function to determine if there is any overlap within the set. Write test cases. Which data structure would be best to represent the intervals.
- Aashish June 23, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer in Test - 2of 2 votes
AnswersDoes it always happen that stack always grows downwards & heap grows upwards?
- Aashish June 22, 2012 in India
If its so, then how does OS keeps the heap area protected from the interference of the stack & vice-versa?
If its not, then what factors affect it? OS version ? Compiler? Anything else??| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Operating System - 0of 0 votes
AnswersHow to print the outside frame of a binary tree.
1. the order is top to down, left to right, then down to top
2. print all leftest node and rightest nodes
3. print all leaf nodes
4. print all nodes which only have 1 leaf100 50 150 24 57 130 12 30 60 132
e.g:
- Yaya June 20, 2012 in United States
the output should be
100, 50, 24, 12, 30, 57, 60, 130, 132, 150| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersQ: print out all leaf node path with non recursive method
The structure of node is *NOT* binary tree, is just a normal tree.// print out all leaf node path // 12 // 4 8 22 //1 2 3 9 18 24
the output is like:
- Yaya June 19, 2012 in United States
12, 4, 1,
12, 4, 2,
12, 4, 3,
12, 4, 8, 9,
12, 4, 8, 22, 18,
12, 4, 8, 22, 24,| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm - 0of 0 votes
AnswersIn a X's and 0's game (i.e. TIC TAC TOE) if you write a program for this give a fast way to generate the moves by the computer. I mean this should be the fastest way possible.
- tulip June 15, 2012 in India| Report Duplicate | Flag | PURGE
Microsoft Software Engineer / Developer Algorithm