Showing posts with label Microsoft. Show all posts
Showing posts with label Microsoft. Show all posts

Wednesday, February 13, 2013

Microsoft Interview of Monika Bisla

Written Test (Nov, 2012):
30 MCQs based on Algorithms & logical aptitude and 2 coding problems.

Telephonic Interview (7th January, 2013):
All questions related to your resume & projects and some behavioral questions.

Interviews (27th January, 2013):

Round 1:
  1. Write code for run-length encoding of a given string in-place (without using any extra memory).
    Sample Input: aaaaaaaaaabcccccc Output: a10bc6
  2. Write code for a function which converts a given integer to a string. (Use only one for-loop).Check for all the boundary cases.
  3. Suppose you are going to organize a party from 9:00 am to 20:00 pm. You have invited 'n' number of guests for the party. You are given the arrival time and the departure time of all guests. Every time a new guest arrives, you give him a glass of wine and when he leaves, you take the glass back. If someone has left and returned the glass, you can give the same glass to a new guest who has just arrived.
    Based on the given schedule for guests, determine the minimum number of glasses required for the party. A guest can come or leave at any time, but you are given the fixed schedule. Write code for the given problem.
Round 2:
Some questions related to resume and subjects studied in the curriculum.
  1. How can we do a Tree Traversal without using a stack (not even the stack for recursion). Write code for an in-order traversal without using stack. What would be the changes in the function if we want to do a pre-order or post-order traversal?
  2. Write code for finding loop in the singly linked list and fixing it.
  3. Given a linked list with two pointers, one is next pointer and another is a random pointer which can point to any node in the list (forward, backward or itself), you have to make a copy of this list without tempering the original list. Write the code for the same in O(n) time complexity.
Round 3:
  1. Give different possible approaches for Checking whether two strings are anagrams (with and without using hash tables). What are the possible advantages and drawbacks of each approach? Write code for the approach which involves first sorting the two strings and then matching character by character (O(n lg n) approach). Which sorting you will use and why? Write test cases also.
  2. Write code for counting the number of inversions in an array in the minimum time possible. What could be different possible approaches?
  3. Given two huge numbers represented as linked list, write a function to add them and return a number in the same format.
    Ex: 950 represented as 9->5->0->NULL
    150 represented as 1->5->0->NULL
    then, the output should be 1->1->0->0->NULL
  4. We have ‘n’ people in a party, out of whom only one can be a celebrity. And he may or may not be present in the party. A celebrity is known to everyone but he does not know anyone. All other person may or may not know each other. If a person ‘A’ knows ‘B’, it does not implies that ‘B’ also knows ‘A’. You can ask only one question to someone ‘Do you know this (‘X’) person?’ and he can only reply in YES or NO. Your job is to find the celebrity in minimum number of questions.
Round 4:
First he asked general questions from resume.
  1. Write code for finding the least common ancestor of two given nodes in a binary tree. ( both recursive and iterative approach).
  2. Which data-structure you will use for implementing the ‘malloc’ and ‘free’ functions? (You have been given with a pointer which points to a large chunk of memory).Write full codes for implementing these two functions.
Each face-to-face round duration was approximately 1 hour. Results were declared after 4 days of interviews. Every interview was an eliminating round. Questions were not very hard but they were very keen on accuracy and efficiency of code (it should run on all possible input cases).

Thursday, October 22, 2009

Microsoft Interview of Varun Bhatia

The interview started off with my introduction and the interviewee asked me to provide all details about my hobbies, strengths, weakness etc.
Then he shifted to my projects. He asked me details of my few projects. He wanted to know the aim of the projects, my contribution to them, how many team members were involved in it, what was the time limit. He also asked what problems I faced while implementing the project and how I solved them. and if we took someone's help.

My advice in project related questions will be that only mention those projects in your resume that you are comfortable with..... Also this comfort level will come only by doing these projects themselves...also tell only what you have actually implemented....do not try to fool the interviewee by telling things that you did not actually implement in your project.... also use only those terms to exlpain your project that you are comfortable with...do not use heavy terms unless you are well prepared with what they actually mean.....

After half an hour discussion on my projects, he shifted to data structures and algo...
Firstly he asked me to write the code of preorder....i easily did that recursively...next he told me to do the same without using recursion....i was prepared with this problem and answered that.....  
the last and final question was that you are given two arrays and you have to place those elements in the third array that are common to both.....
ex arr1 = {1,2,3,4,5,6,7}
     arr2 = {5,6,7,8,9,1,2}
then arr3 should be {1,2,5,6,7}

I told many approaches to it but he wanted to listen to the approach that he had in his mind....i was not able to figure that but since i gave 2-3 approaches for the same problem...next he asked me to write the code for implementation i gave.....since it was a telephonic interview, and he could neither see my code nor was he writing when i was telling the code, he asked me to test my own code and find bugs in it.....i found two to three syntax as well as logical mistakes and he was ok with it...maybe he was testing my testing ability......

thats all  !!

All the best for your placement preparation.....
Just stay confident.... any company does not expects the perfect answer from the start....your problem solving techniques are also important and they matter a lot....