April 28 ends the last three sides. Waited one months before the offer was received at the beginning of the month. Since three interviewers didn't ask me to keep the contents of the interview confidential, I now record the entire process of interviewing Microsoft as a blog post for future interviewers to refer to. Reprint please indicate the source: Http://blog.csdn.net/xiefubao.
When the school began to learn that Microsoft in Xian this year did not preach and written the scene, that Microsoft is not ready to recruit in Xian. Later in the official website to see this is an online written exam. At the end of March, the resume was ready and the Chinese resume was prepared, and a very rough English resume was temporarily rushed. The first round of written examinations was received in early April. The first round of written 2 hours, four English programming topics, more difficult than the ACM simple. At that time to do a more regrettable is the third problem, the preprocessing data wrote a n^2 algorithm, had only 10 points, at that time also thought that there is no tube, and later heard that there is a classmate of the third problem completely violent wrote a n^3 program incredibly took 100 points, sigh, Perhaps then continue to check the program's bug test will be able to take at least 300 points, all kinds of embarrassing, but still in mid-April received a second online test notice. The second test is divided into two types of questions, one is the mathematical ability to test the problem: are some very simple math problems, but more topics, probably less than a minute to do together, and some need to use the calculator to calculate the results. The other is the language proficiency test: Chinese Middle school is not very good, the most afraid of this. Probably is to give a paragraph first, and then give a paragraph b, according to a judge B correct error or uncertain, time is also relatively tight.
About April 20 received the 24th interview notice, is an online interview. Then went online to see a lot of Microsoft's face.
One side of the interviewer is a JJ, although can only hear each other voice, but the feeling should be very young. One side of Microsoft JJ is very amiable, like to laugh, this also somewhat reduced the point of my tension. I probably introduced myself, then Microsoft JJ began to ask me questions: The first general asked a sentence if the program output error results, I will be how to check the wrong. According to the usual experience of doing problems, I said if it is in the OJ, I will return the result is WA, tle or re and so on type to see the possible bug,balabala of the program .... (feeling very naive, according to JJ asked at that time also can not think how to answer). Later JJ said if the program input data unchanged, the code does not change, but the results of multiple runs may be what reason, (to tell the truth, compared to the specific algorithm, I am more afraid of this open question). Suppressed for a long time, probably said several possibilities: The program uses the new, malloc and so on application heap memory command, the program calls to obtain the system function, the program reads the network or the file data, the program uses the stochastic algorithm and so on. But JJ always let me go on, then really think of the other, sister changed the question. After the end found that there is a very important and obvious multithreading at the time did not say (estimated this point is a lot of points).
Later JJ gave a specific topic: to a Chinese character string and phonetic string, asked how to determine the character string and phonetic string matching.
At a glance, feel good simple, I said first to have each Chinese pronunciation of the data storage, and then the Chinese characters and phonetic strings from left to right sweep, if there is a mismatch on the description can not match. JJ said there will be more than a word, and instantly feel just naive again. I said that search it, encountered multiple-tone words to try every way, every way to go backwards. Then JJ asked me about the approximate time complexity of this method, I said that theoretically the worst would be the number of time complexity, but the actual should not have that limit data. I feel like sweeping again, because pronunciation will go back very quickly and won't go too deep. Then JJ let me start to write this code on the whiteboard. At that time Meng, the whiteboard is equivalent to no TAB key txt AH. I asked JJ if it could be written on the local IDE, JJ said so. Read the data I said is not the key, mainly wrote the DFS search function, the process of writing JJ also said to go out to buy a thing. Here is the main part of the code that was written: [cpp] view plain copy map<char,vector<string>> maps; string s1,s2; Bool dfs (int t1,int t2) { if (T1==s1.size () &&t2==s2.size ()) return true; if (T1==s1.size () &&t2!=s2.size () ) return false; if (T1!=s1.size () &&t2==s2.size ()) return false; map<char,vector<string> >::iterator p= Maps.find (S1[t1]); for (Int i=0; i<p->second.size (); i+ +) { string tool=p->second[i]; bool flag=1; for (Int i=0; i<tool.size (); i++) if (S2[t2+i]!=tool[i]) { flag=false; break; } if (flag&& dfs (T1+1,t2+tool.size ())) return true; } return false; } then JJ asked me the time complexity of the code, I said and just about the analysis, the worst point of magnitude, the average should be O (n). Then I said something else that was not relevant to technology was over. Later and bw's discussion found that actually write that code plus a two-dimensional array of memory can avoid the theoretical exponential level of complexity (usually write so many memory search topics, the key of this interview unexpectedly, maybe JJ has been asked the complexity of the time I said that optimization). With this lesson, in the future interview will certainly pay attention to more calm thinking, but also think about the interviewer to ask each question intention, sensitive to perceive the interviewer's direction.
Two sides of the interviewer is a GG. GG speak very organized, sometimes the signal is not very good can also feel GG in saying the problem, deliberately slow down to let me hear clearly. Two sides of the question are relatively broken, may have some individual already remember, write their own remember it.
He first asked a hypothetical question, that is, there is a news release platform, at most at any time can only have a user to send messages, ask me how to achieve. A bit to touch the core of GG is not to ask how to avoid mutual exclusion of it. Bite the bullet, I said with a release information of the lock, a user sent the message can be released after the lock, and send information must first obtain this lock. Then GG didn't say anything to change the problem. Here's a question: there's an indefinite array of integers, each integer between 1-1000, asking how to go heavy. (A burst of joy in the heart, how to ask such a simple question). I confirmed to GG that the core of this problem is to go heavy instead of how to deal with the indefinite length of the array and then say open a 1000-length bool type array used to go heavy, time complexity is O (n) (has reached the lower limit can not be optimized again). GG said the method is correct, and then asked me if there is no way to optimize the complexity of space. Another Meng, O (n) space complexity can also be optimized. is O (1), O (0)? later said that can also be sorted and then go heavy, the space is optimized to O (0), but the time increased to Nlogn. GG Only said that this is a way to optimize the space and then change the problem. (so far to think of the show tease their own bit optimization space to forget, and GG said optimization space When also must wait is this method ah, embarrassed).
GG then asked a geometric question: give two triangles, ask how to determine whether two triangles have overlapping parts. have done the simple calculation geometry problem in ACM should all be able to drop this problem in seconds. Then I said my own solution: divided into two types of overlapping:
First, to determine whether there is a nesting situation (to determine whether a triangle of three points are in another triangle inside). And then I said the way to judge whether a point is within a triangle: clockwise calculates the directed angle of this point and three segments, and the inside of the triangle is 360 degrees, and the outer point gets 0 degrees.
If there is no nesting situation, then two triangles have overlapping parts must have segment intersection. At this point, 22 to determine whether the segments intersect. And then I said, the way to judge the intersection of two segments: if two segments AB intersect with the CD, point A and B will be on both sides of the straight CD, while the point C and D must be on both sides of the line AB. Judge two Point A, b whether the way on both sides of the line CD: The AC and ad vectors and the cross product of the BC and BD vector multiplication, the result is a negative number on the CD on the side of the a,b, a positive note on the same side, 0 of the words will indicate at least one on the line CD. After that, GG affirmed my method and changed the question.
In all the technical facets of Microsoft, writing programs on the spot seems like a few. Two face GG The last problem is programming: a binary tree root node is defined as layer No. 0, write a function, enter the root node address and M, implement the task of saving the data of the M-level node. Very basic a recursive topic, after writing the past GG said can be finished two sides.
The following is a key part of the two-side code:
[CPP] View plain copy struct node {node *left,*right; int value; }; Vector<int> VEC; void Dfs (node* p,int m) {if (p==null) return; if (m==0) {vec.push_back (p->value); return; DFS (P->LEFT,M-1); DFS (P->RIGHT,M-1); }
The next day on the two side received three notices, the time is in the afternoon of 28th.
On the three sides of the interviewer is still a GG, he said he is from the West, not far from our school. Because of the three-face GG initiative to open the video function, I also opened their own video function, so you can see each other (in fact, it is best not to open, see the other side will become more nervous, this is my personal feeling). GG also opened a few jokes, may be to let the interviewer relax and play it well. But I seem to have been more nervous (at that time it was clear that this would be their own life and death face). Start more than 10 minutes probably chat a few words, GG asked a few points on the resume, I also probably said under their own college life. After the chat, GG said according to Microsoft's practice, the program is sure to write. Then ask me if I know the multiplication of large numbers (this is the basis of the ACM tool), I said previously used in the array to simulate the large number of operations of the template, overload +-*/and other symbols. Then he said to write a string to simulate the multiplication of large numbers. I said I did not write this, but should be able to write it (at that time really feel very empty, afraid of writing is not good, almost refused to come down, but the feeling of refusing to write almost means that is eliminated, to bite the bullet and promised to come down). Then three sides GG gave me my function statement, shut his voice said give me half an hour to write, but I have been under his supervision. I probably drew a picture on the paper, thinking clearly began to write, about more than 10 minutes, but has been out of the results, some data input after the output or garbled, has been tuned to more than 20 minutes before the correct results. The test of several groups of results are correct, called the interview Gg said finished. GG let through the mailbox sent over. But there was a delay in sending the message, and he said that in the delay, let me talk about the idea of my own program first. I said, Blablabla ... Later GG asked how has not received the mail, brain a Meng, oneself only said, incredibly did not first send an e-mail, too embarrassed, hurriedly hair past, GG at that time also smiled and said that they have made such a terrible thing. After the hair, I found that the input 0*0 program returned the empty string, hurriedly changed a bit and sent again. The following is a key part of the code that was sent the second time around:
[cpp] View Plain copy char ans[1000]; Char* add_big_integer (char* value1, char* value2) { int len1=strlen (value1); int len2=strlen (value2); memset (ans,0,sizeof ans); reverse (value1,value1+len1); reverse (VALUE2,VALUE2+LEN2); for (int i=0; i<len1; i + +) for (int j=0; j<len2; j++) { int tool= (value1[i]-' 0 ') * (value2[j]-' 0 '); int t=i+j; if (ans[t]==0) ans[t]= ' 0 ' +tool%10; else ans[t]+=tool%10; if (ans[t+1]==0) ans[t+1]= ' 0 ' +tool/10; else ans[t+1]+=tool/10; int res=0; &nBsp; while (ans[t]> ' 9 ') { res= (ans[t]-' 0 ')/10; ans[t]= ' 0 ' + (ans[t]-' 0 ')%10; ans[t+1]+=res; t++; } } int len=strlen (ans); while (ans[len-1]== ' 0 ') { ans[len-1]=0; len--; if (len==1) break; } reverse (ans, Ans+len); return ans; } char s1[1001]; char s2[1001]; int main () { while (scanf ("%s%s", S1,s2) ==2) printf ("%s", Add_big_ Integer (S1,S2)); return 0; }
Then GG said that if I were to test what kind of data my program would use, I probably said that will use 0 such boundary data (obviously just 0*0 on the error), also will use the negative number multiplication (with GG said own program not to handle the negative situation, but very good modification, starts to judge the sign on line, GG said has no relation). Then GG continue to ask me what kind of data input, during the sound signal is not good GG also use the way of typing let me continue to add the answer to this question. I really can not imagine what data to use (at that time think is to try several groups of data Bai, almost should be right.) But surely it cannot be said. Then the interviewer GG has been to the top guide, and finally he said it out: if the input 0000000123456789 multiply by another number of such data, the function will have a lot of useless calculation (at that time did not think of this, GG a word out of my direct feeling will kneel). I said yes, if you have such data, you have to process it in the input to remove the prefix 0. After the interview GG also did not ask what, asked me if there is any problem, I asked about a few days after the notice results, GG said a week or so human resources department will have notice. Then he hung up on the greeting.
Before the interview himself on the internet to see a lot of Microsoft, now only this text for the future of the study of younger siblings reference it.