Beijing, China interview questions | Glassdoor

# Interview questions in Beijing, China

Microsoft Interviews in Beijing

www.microsoft.com /  HQ: Redmond, WA

41 Interviews in Beijing (of 8,422)

3.2 Average

VIPKID Interviews in Beijing

www.vipkid.com /  HQ: San Francisco

41 Interviews in Beijing (of 413)

3.0 Average

Baidu Interviews in Beijing

www.baidu.com /  HQ: Sunnyvale, CH

39 Interviews in Beijing (of 119)

2.9 Average

## Interview Questions in Beijing

Sort: RelevancePopular Date

### Senior Software Engineer at Amazon was asked...

Oct 18, 2011
 Rand(7) from Rand(5)7 AnswersThe simple solution is to implement RandBin() using Rand5(). int RandBin() { }Sorry this UI posts without warning int RandBin() { int rand5Res = Rand5(); return rand5Res < 2 ? 0 : rand5Res < 4 ? 1 : RandBin(); } And then use RandBin() to implement Rand7; int Rand7() { int rand = RandBin() << 2 | RandBin() << 1 | RandBin(); return rand < 7 ? rand : Rand7(); }int rand7() { while(1) { int n = ((rand5()%2)*4 + (rand5()%2)*2 + (rand5()%2)*1); if(n == 0) continue; return n; } } The rand5()%2 will generate 0 and 1 with equal probability and we need 3 bits since we are going from 000 upto 111. So we call this function thrice for each bit position.Show More ResponsesAbove answer is not correct because 0 is not returned. We need equal probability for all 0, 1,2,3,4,5,6. The modified would be: int rand7() { while(1) { int n = ((rand5()%2)*4 + (rand5()%2)*2 + (rand5()%2)*1; if(n==0) continue; return n-1; } }Java: Random r = new Random(); r.nextInt(5)+r.nextInt(5)%3what about calling rand(5) 7 times adding it then % 7 ( rand5() + rand5() + rand 5() + rand5() + rand5 () + rand5() + rand5() ) % 7 -suhaneint r = rand5() *5 + rand5() while (r>=21){ r = rand5() *5 + rand5(); } return r%7;

### Software Engineer II at Microsoft was asked...

Jul 3, 2012
 Given a set of strings. Check if a new string is equal to any of them. Here equal means the letters are the same, like abbc=bacb4 Answersvoid main() { char a[]= "bony"; char [b]="subhao"; int l, c; char ch; l=strlen(a); int i,j; for(i=0;ivoid main() { char a[]= "bony"; char [b]="subhao"; int l, c; char ch; l=strlen(a); int i,j; for(i=0;iusing System; using System.Collections.Generic; namespace SampleNamespace { public class SampleClass { public static void Main() { string a = "string1"; string a2 = "1string"; Dictionary _dict = new Dictionary(); //load it up - linear loop foreach(char _c in a) _dict.Add(_c, _c); bool _matched = true; //just loop through second string chars and check from dictionary //if there is not a match break the look and string are not equal foreach(char _c2 in a2) if (_dict.ContainsKey(_c2) == false) { _matched = false; break; } if (_matched) System.Console.WriteLine("Matched..."); else System.Console.WriteLine("Does not match..."); } // End of Main function (program statup) } // End of SampleClass } // End of SampleNamespaceShow More Responsesusing System; using System.Collections.Generic; namespace SampleNamespace { public class SampleClass { public static void Main() { string a = "string1"; string a2 = "1string"; Dictionary _dict = new Dictionary(); //load it up - linear loop foreach(char _c in a) if (_dict.ContainsKey(_c) == false) _dict.Add(_c, _c); bool _matched = true; //just loop through second string chars and check from dictionary //if there is not a match break the look and string are not equal foreach(char _c2 in a2) if (_dict.ContainsKey(_c2) == false) { _matched = false; break; } if (_matched) System.Console.WriteLine("Matched..."); else System.Console.WriteLine("Does not match..."); } // End of Main function (program statup) } // End of SampleClass } // End of SampleNamespace

### Engineer at Microsoft was asked...

Mar 14, 2010
 Give an idea to show how to rearrange the array a1, a2, ..., an, b1, b2, ... bn into a1, b1, a2, b2, ..., an, bn with O(n) computation time cost and O(1) extra memory cost.3 AnswersThis question is not so easy as you may look it like. Please check your idea with programming validation (for n=5 to 20 would be OK), you'll find out why.I have no idea how to solve it... hint?One way to do it is to move from the outer side (from both sides) towards inside. At each iteration swap the content so that that the position is correct up to that stage. This must be done from both sides for each iteration. If you try for case n=2, n=3. n=4, n=5 ... it will quickly show you the symmetric swap pattern from both sides.

### Software Development Engineer at Microsoft was asked...

Oct 19, 2011
 Implement Fibonacci in log_n time2 Answersusing matrixThere is are three different solutions of this problem with detailed analysis on the website: http://codercareer.blogspot.com/2011/10/no-15-fibonacci-sequences.html.

### Engineer at Microsoft was asked...

May 17, 2010
 The student cards are 7 digit numbers, from 0000000 to 9999999. If they are not in order and I would like to make it in-order. I will give you 6 helpers, how will you help me to solve this problem and the complexity of solving this problem.2 AnswersAssuming you have to sort all the cards - there are 10 millions! Assuming eacg card is 0.1 mm tick - they'll stack in a pile of 1Km! A good way to solve the problem is to send the 6 herpers to the college/university - to learn, and work to make some money. Then - with that money - make make them build a huge machine for sorting those cards... No really: split the pile in 6 (or seven including your self) then again and again until you get to a smaller pile you may sort yourself easily - you get something like 50000 piles of 200 cards to start with! You'll have to use your 6-member team about 8000 time to sort those piles, and this is only the first level! And in the 200-card pile each member is on his/her own!For me "how will you help me to solve this problem and the complexity of solving this problem." is the key. Assume we're at MS, why should I waste time with "the complexity of solving this problem." I can contact some really smart people. I'd define the data set better. How many cards total, currently random order or not, limited to some or all digits 1 to <10^8, etc Then I'd call an analytics guy and ask if there is an algorithm to do this and can it parallelize into 7 threads. Look up the algorithm in Bing. Ask a coder how to implement it with 7 threads in pseudo code Convert coder's pseudo code into instructions for the team. Start sorting.

### Marketing Communication Supervisor at Cathay Pacific was asked...

Aug 19, 2010
 how do you know about marketing? do you have any experience of marketing?2 Answersthere is no marketing position in my current company, but i did almost all marketing comm job there.The interview question is just eating-up time: "how do you know about marketing?" The word "Marketing" is no secret password! Second, how come CX invites someone for a Markcomm supervisor position where they still doubt this person ever got in touch with the subject? Very superficial talk.

### Account Manager at ChinaNetCenter was asked...

Apr 23, 2013
 No special questions. 1 AnswerJust be honest.

### Consultant at Deloitte was asked...

Jan 9, 2013
 The questions are not so much tough, basically general question, the most important thing you have do is to convince recruiter that you could transfer previous skills to new role or position. 1 AnswerConnect your post experience to your current job description

### Financial Analyst at China Life Insurance was asked...

Oct 6, 2015
 How to evaluate a company? What is the company you analyzed?1 AnswerJust say what you know about the company as detailed as you can.

### Junior Data Analyst (Turned to Senior Data Analyst Turned to Not Good Enough for An) at App Annie was asked...

Feb 15, 2015
 What impact do console game sales have on mobile game sales.1 AnswerI'm not that familiar with console game sales but I would assume there was little correlation as they represent very different markets and user bases despite both being games. (In work I run into App Annie people all the time and always end a conversation with this question and they are just as confused as I was as why someone is asking them such a stupid question. They also agree it's probably unrelated.)
110 of 1,871 Interview Questions